]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/huge.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / huge.exp
1 # Copyright 2001-2024 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
15
16 # This file was written by Michael Snyder (msnyder@redhat.com)
17
18
19 # Define if you want to skip this test
20 # (could be very time-consuming on remote targets with slow connection).
21 #
22 require {!target_info exists gdb,skip_huge_test}
23
24 standard_testfile .c
25
26 set max [expr 2 * 1024 * 1024]
27 set min 16
28
29 set opts {}
30 lappend opts debug
31
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 } {
36 continue
37 }
38
39 set compilation_succeeded 1
40 break
41 }
42 require {expr $compilation_succeeded}
43
44 # Start with a fresh gdb.
45 clean_restart ${binfile}
46
47 save_vars { timeout } {
48 set timeout 30
49
50 if {![runto_main]} {
51 return -1
52 }
53
54 gdb_test_no_output "set max-value-size unlimited"
55
56 gdb_test_no_output "maint set per-command space on"
57
58 set re1 \
59 [list \
60 [string_to_regexp $] \
61 $decimal \
62 " = " \
63 [string_to_regexp "{0 <repeats "] \
64 $decimal \
65 [string_to_regexp " times>}"]]
66 set re2 \
67 [list \
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 ""]]
73 set space_used -1
74 gdb_test_multiple "print a" "print a very large data object" {
75 -re -wrap $re {
76 set space_used $expect_out(1,string)
77 pass $gdb_test_name
78 }
79 }
80
81 set test "not too much space used"
82 if { $space_used == -1 } {
83 unsupported $test
84 } else {
85 # At 56 passes with and without the fix, so use 55.
86 gdb_assert {$space_used < [expr 55 * 4 * $size] } $test
87 }
88 }