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 # This file was written by Michael Snyder (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 set max [expr 2 * 1024 * 1024]
32 set compilation_succeeded 0
33 for { set size $max } { $size >= $min } { set size [expr $size / 2] } {
34 set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]]
35 if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } {
39 set compilation_succeeded 1
42 require {expr $compilation_succeeded}
44 # Start with a fresh gdb.
45 clean_restart ${binfile}
47 save_vars { timeout } {
54 gdb_test_no_output "set max-value-size unlimited"
56 gdb_test_no_output "maint set per-command space on"
60 [string_to_regexp $] \
63 [string_to_regexp "{0 <repeats "] \
65 [string_to_regexp " times>}"]]
68 "Space used: $decimal" \
69 [string_to_regexp " (+"] \
70 "($decimal) for this command" \
71 [string_to_regexp ")"]]
72 set re [multi_line [join $re1 ""] [join $re2 ""]]
74 gdb_test_multiple "print a" "print a very large data object" {
76 set space_used $expect_out(1,string)
81 set test "not too much space used"
82 if { $space_used == -1 } {
85 # At 56 passes with and without the fix, so use 55.
86 gdb_assert {$space_used < [expr 55 * 4 * $size] } $test