]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2001-2024 Free Software Foundation, Inc. |
26568747 TV |
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 | # Copied from gdb.base/huge.exp, written by Michael Snyder | |
17 | # (msnyder@redhat.com). | |
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 | require allow_fortran_tests | |
25 | ||
26 | load_lib fortran.exp | |
27 | ||
28 | standard_testfile .F90 | |
29 | ||
30 | set max [expr 2 * 1024 * 1024] | |
31 | set min 16 | |
32 | ||
33 | set opts {} | |
34 | lappend opts debug | |
35 | lappend opts f90 | |
36 | ||
37 | set compilation_succeeded 0 | |
38 | for { set size [expr $max] } { $size >= $min } { set size [expr $size / 2] } { | |
39 | set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]] | |
40 | if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } { | |
41 | continue | |
42 | } | |
43 | ||
44 | set compilation_succeeded 1 | |
45 | break | |
46 | } | |
47 | require {expr $compilation_succeeded} | |
48 | ||
49 | # Start with a fresh gdb. | |
50 | clean_restart ${binfile} | |
51 | ||
52 | save_vars { timeout } { | |
53 | set timeout 30 | |
54 | ||
55 | if {![fortran_runto_main]} { | |
56 | return -1 | |
57 | } | |
58 | ||
59 | gdb_test_no_output "set max-value-size unlimited" | |
60 | ||
61 | # Not needed for the C variant, see PR exp/30817. | |
62 | gdb_test_no_output "set print elements unlimited" | |
63 | ||
64 | gdb_test_no_output "maint set per-command space on" | |
65 | set re1 \ | |
66 | [list \ | |
67 | [string_to_regexp $] \ | |
68 | $decimal \ | |
69 | " = " \ | |
70 | [string_to_regexp "(0, <repeats "] \ | |
71 | $decimal \ | |
72 | [string_to_regexp " times>)"]] | |
73 | set re2 \ | |
74 | [list \ | |
75 | "Space used: $decimal" \ | |
76 | [string_to_regexp " (+"] \ | |
77 | "($decimal) for this command" \ | |
78 | [string_to_regexp ")"]] | |
79 | set re [multi_line [join $re1 ""] [join $re2 ""]] | |
80 | set space_used -1 | |
81 | gdb_test_multiple "print array1" "print a very large data object" { | |
82 | -re -wrap $re { | |
83 | set space_used $expect_out(1,string) | |
84 | pass $gdb_test_name | |
85 | } | |
86 | } | |
87 | ||
88 | set test "not too much space used" | |
89 | if { $space_used == -1 } { | |
90 | unsupported $test | |
91 | } else { | |
92 | # At 112 passes with and without the fix, so use 111. | |
93 | gdb_assert {$space_used < [expr 111 * 4 * $size] } $test | |
94 | } | |
95 | } |