]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2001-2024 Free Software Foundation, Inc. |
21b9b5b1 MS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
21b9b5b1 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
21b9b5b1 MS |
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. | |
e22f8b7c | 12 | # |
21b9b5b1 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
21b9b5b1 | 15 | |
21b9b5b1 MS |
16 | # This file was written by Michael Snyder (msnyder@redhat.com) |
17 | ||
21b9b5b1 MS |
18 | |
19 | # Define if you want to skip this test | |
20 | # (could be very time-consuming on remote targets with slow connection). | |
21 | # | |
450d26c8 | 22 | require {!target_info exists gdb,skip_huge_test} |
21b9b5b1 | 23 | |
f8b41b00 | 24 | standard_testfile .c |
f6c957d2 | 25 | |
d03878e6 TV |
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 | |
21b9b5b1 | 41 | } |
d03878e6 | 42 | require {expr $compilation_succeeded} |
21b9b5b1 MS |
43 | |
44 | # Start with a fresh gdb. | |
f8b41b00 | 45 | clean_restart ${binfile} |
21b9b5b1 | 46 | |
d03878e6 TV |
47 | save_vars { timeout } { |
48 | set timeout 30 | |
21b9b5b1 | 49 | |
d03878e6 TV |
50 | if {![runto_main]} { |
51 | return -1 | |
52 | } | |
5fdf6324 | 53 | |
d03878e6 | 54 | gdb_test_no_output "set max-value-size unlimited" |
21b9b5b1 | 55 | |
26568747 TV |
56 | gdb_test_no_output "maint set per-command space on" |
57 | ||
58 | set re1 \ | |
d03878e6 TV |
59 | [list \ |
60 | [string_to_regexp $] \ | |
61 | $decimal \ | |
62 | " = " \ | |
63 | [string_to_regexp "{0 <repeats "] \ | |
64 | $decimal \ | |
65 | [string_to_regexp " times>}"]] | |
26568747 TV |
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 | } | |
d03878e6 | 88 | } |