1 # Copyright 2001-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Copied from gdb.base/huge.exp, written by Michael Snyder
17 # (msnyder@redhat.com).
19 # Define if you want to skip this test
20 # (could be very time-consuming on remote targets with slow connection).
22 require {!target_info exists gdb,skip_huge_test}
26 require allow_ada_tests
28 standard_ada_testfile foo
30 set max [expr 2 * 1024 * 1024]
36 set compilation_succeeded 0
37 for { set size $max } { $size >= $min } { set size [expr $size / 2] } {
38 set try_opts [concat $opts [list additional_flags=-gnateDCRASHGDB=$size]]
39 # Use gdb_compile_ada_1 to prevent failed compilations from producing a
41 if {[gdb_compile_ada_1 "${srcfile}" "${binfile}" executable \
46 set compilation_succeeded 1
49 require {expr $compilation_succeeded}
51 foreach_with_prefix varname {Arr Packed_Arr} {
52 clean_restart ${testfile}
54 save_vars { timeout } {
61 gdb_test_no_output "set max-value-size unlimited"
62 gdb_test_no_output "maint set per-command space on"
65 [string_to_regexp $] \
68 [string_to_regexp "(0 <repeats "] \
70 [string_to_regexp " times>)"]]
73 "Space used: $decimal" \
74 [string_to_regexp " (+"] \
75 "($decimal) for this command" \
76 [string_to_regexp ")"]]
77 set re [multi_line [join $re1 ""] [join $re2 ""]]
79 gdb_test_multiple "print $varname" "print a very large data object" {
81 set space_used $expect_out(1,string)
86 set test "not too much space used"
87 if { $space_used == -1 } {
90 # At 56 passes with and without the fix, so use 55.
91 gdb_assert {$space_used < [expr 55 * 4 * $size] } $test