OLD | NEW |
1 # Copyright 1992, 1994-2000, 2002-2004, 2007-2012 Free Software | 1 # Copyright 1992-2013 Free Software Foundation, Inc. |
2 # Foundation, Inc. | |
3 | 2 |
4 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 6 # (at your option) any later version. |
8 # | 7 # |
9 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
13 # | 12 # |
14 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 15 |
17 # This file was written by Fred Fish. (fnf@cygnus.com) | 16 # This file was written by Fred Fish. (fnf@cygnus.com) |
18 | 17 |
19 | 18 |
20 set testfile "scope" | 19 standard_testfile scope0.c scope1.c |
21 set binfile ${objdir}/${subdir}/${testfile} | |
22 | 20 |
23 | 21 if {[prepare_for_testing ${testfile}.exp ${testfile} \ |
24 if { [gdb_compile "${srcdir}/${subdir}/scope0.c" "${binfile}0.o" object {debug}
] != "" } { | 22 » [list $srcfile $srcfile2] {debug}]} { |
25 untested scope.exp | 23 return -1 |
26 return -1 | |
27 } | |
28 | |
29 if { [gdb_compile "${srcdir}/${subdir}/scope1.c" "${binfile}1.o" object {debug}
] != "" } { | |
30 untested scope.exp | |
31 return -1 | |
32 } | |
33 | |
34 if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}]
!= "" } { | |
35 untested scope.exp | |
36 return -1 | |
37 } | 24 } |
38 | 25 |
39 # Create and source the file that provides information about the compiler | 26 # Create and source the file that provides information about the compiler |
40 # used to compile the test case. | 27 # used to compile the test case. |
41 if [get_compiler_info] { | 28 if [get_compiler_info] { |
42 return -1; | 29 return -1 |
43 } | 30 } |
44 | 31 |
45 # Test locating various things when stopped just inside main, after | 32 # Test locating various things when stopped just inside main, after |
46 # running init0(). To prevent cascading of errors, we report the | 33 # running init0(). To prevent cascading of errors, we report the |
47 # first one and quit. If all pass, then we print the pass results. | 34 # first one and quit. If all pass, then we print the pass results. |
48 | 35 |
49 proc test_at_main {} { | 36 proc test_at_main {} { |
50 global gdb_prompt | 37 global gdb_prompt |
51 global decimal | 38 global decimal |
52 global det_file | 39 global det_file |
53 global srcdir | 40 global srcdir |
54 global subdir | 41 global subdir |
55 global hp_cc_compiler | 42 global hp_cc_compiler |
56 | 43 |
57 # skip past init0. | 44 # skip past init0. |
58 # This used to do an extra "next" if the first one didn't get us | 45 # This used to do an extra "next" if the first one didn't get us |
59 # over the call to init0, to handle calls to __main in the | 46 # over the call to init0, to handle calls to __main in the |
60 # prologue, etc. But if a breakpoint at main doesn't leave us on | 47 # prologue, etc. But if a breakpoint at main doesn't leave us on |
61 # the first line of real code in the function, that's a GDB bug. | 48 # the first line of real code in the function, that's a GDB bug. |
62 gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main" | 49 gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main" |
63 | 50 |
64 # Print scope0.c::filelocal, which is 1 | 51 # Print scope0.c::filelocal, which is 1 |
65 | 52 |
66 if [gdb_test "print filelocal" "\\\$$decimal = 1" "print filelocal" ] { | 53 if [gdb_test "print filelocal" "\\\$$decimal = 1" "print filelocal" ] { |
67 gdb_suppress_tests ; | 54 gdb_suppress_tests |
68 } | 55 } |
69 | 56 |
70 | 57 |
71 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0
.c'::filelocal at main" "No symbol \"scope0.c\" in current context.*" "print '$
srcdir/$subdir/scope0.c'::filelocal"] { | 58 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0
.c'::filelocal at main" "No symbol \"scope0.c\" in current context.*" "print '$
srcdir/$subdir/scope0.c'::filelocal"] { |
72 gdb_suppress_tests ; | 59 gdb_suppress_tests |
73 } | 60 } |
74 | 61 |
75 | 62 |
76 # Print scope0.c::filelocal_bss, which is 101 | 63 # Print scope0.c::filelocal_bss, which is 101 |
77 | 64 |
78 if [gdb_test "print filelocal_bss" "\\\$$decimal = 101" "print filelocal_bss
" ] { | 65 if [gdb_test "print filelocal_bss" "\\\$$decimal = 101" "print filelocal_bss
" ] { |
79 gdb_suppress_tests ; | 66 gdb_suppress_tests |
80 } | 67 } |
81 | 68 |
82 | 69 |
83 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print '
scope0.c'::filelocal_bss in test_at_main" "No symbol \"scope0.c\" in current co
ntext.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { | 70 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print '
scope0.c'::filelocal_bss in test_at_main" "No symbol \"scope0.c\" in current co
ntext.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { |
84 gdb_suppress_tests ; | 71 gdb_suppress_tests |
85 } | 72 } |
86 | 73 |
87 | 74 |
88 # Print scope0.c::filelocal_ro, which is 201 | 75 # Print scope0.c::filelocal_ro, which is 201 |
89 | 76 |
90 # No clue why the rs6000 fails this test. | 77 # No clue why the rs6000 fails this test. |
91 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 78 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
92 if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro i
n test_at_main" ] { | 79 if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro i
n test_at_main" ] { |
93 gdb_suppress_tests ; | 80 gdb_suppress_tests |
94 } | 81 } |
95 | 82 |
96 | 83 |
97 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 84 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
98 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 's
cope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$
srcdir/$subdir/scope0.c'::filelocal_ro"] { | 85 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 's
cope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$
srcdir/$subdir/scope0.c'::filelocal_ro"] { |
99 gdb_suppress_tests ; | 86 gdb_suppress_tests |
100 } | 87 } |
101 | 88 |
102 | 89 |
103 # Print scope1.c::filelocal, which is 2 | 90 # Print scope1.c::filelocal, which is 2 |
104 | 91 |
105 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 92 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
106 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1
.c'::filelocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$
subdir/scope1.c'::filelocal"] { | 93 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1
.c'::filelocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$
subdir/scope1.c'::filelocal"] { |
107 gdb_suppress_tests ; | 94 gdb_suppress_tests |
108 } | 95 } |
109 | 96 |
110 | 97 |
111 # Print scope1.c::filelocal_bss, which is 102 | 98 # Print scope1.c::filelocal_bss, which is 102 |
112 | 99 |
113 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 100 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
114 if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print '
scope1.c'::filelocal_bss" "No symbol \"scope1.c\" in current context.*" "print
'$srcdir/$subdir/scope1.c'::filelocal_bss"] { | 101 if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print '
scope1.c'::filelocal_bss" "No symbol \"scope1.c\" in current context.*" "print
'$srcdir/$subdir/scope1.c'::filelocal_bss"] { |
115 gdb_suppress_tests ; | 102 gdb_suppress_tests |
116 } | 103 } |
117 | 104 |
118 | 105 |
119 # Print scope1.c::filelocal_ro, which is 202 | 106 # Print scope1.c::filelocal_ro, which is 202 |
120 | 107 |
121 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 108 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
122 if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} | 109 if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} |
123 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 's
cope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$
srcdir/$subdir/scope1.c'::filelocal_ro"] { | 110 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 's
cope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$
srcdir/$subdir/scope1.c'::filelocal_ro"] { |
124 gdb_suppress_tests ; | 111 gdb_suppress_tests |
125 } | 112 } |
126 | 113 |
127 | 114 |
128 # Print scope1.c::foo::funclocal, which is 3 | 115 # Print scope1.c::foo::funclocal, which is 3 |
129 | 116 |
130 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal
" ] { | 117 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal
" ] { |
131 gdb_suppress_tests ; | 118 gdb_suppress_tests |
132 } | 119 } |
133 | 120 |
134 | 121 |
135 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 122 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
136 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 's
cope1.c'::foo::funclocal" "No symbol \"scope1.c\" in current context.*" "print
'$srcdir/$subdir/scope1.c'::foo::funclocal"] { | 123 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 's
cope1.c'::foo::funclocal" "No symbol \"scope1.c\" in current context.*" "print
'$srcdir/$subdir/scope1.c'::foo::funclocal"] { |
137 gdb_suppress_tests ; | 124 gdb_suppress_tests |
138 } | 125 } |
139 | 126 |
140 | 127 |
141 # Print scope1.c::foo::funclocal_ro, which is 203 | 128 # Print scope1.c::foo::funclocal_ro, which is 203 |
142 | 129 |
143 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::func
local_ro" ] { | 130 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::func
local_ro" ] { |
144 gdb_suppress_tests ; | 131 gdb_suppress_tests |
145 } | 132 } |
146 | 133 |
147 | 134 |
148 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 135 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
149 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "pri
nt 'scope1.c'::foo::funclocal_ro" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { | 136 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "pri
nt 'scope1.c'::foo::funclocal_ro" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { |
150 gdb_suppress_tests ; | 137 gdb_suppress_tests |
151 } | 138 } |
152 | 139 |
153 | 140 |
154 # Print scope1.c::bar::funclocal, which is 4 | 141 # Print scope1.c::bar::funclocal, which is 4 |
155 | 142 |
156 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal
" ] { | 143 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal
" ] { |
157 gdb_suppress_tests ; | 144 gdb_suppress_tests |
158 } | 145 } |
159 | 146 |
160 | 147 |
161 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 148 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
162 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 's
cope1.c'::bar::funclocal" "No symbol \"scope1.c\" in current context.*" "print
'$srcdir/$subdir/scope1.c'::bar::funclocal"] { | 149 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 's
cope1.c'::bar::funclocal" "No symbol \"scope1.c\" in current context.*" "print
'$srcdir/$subdir/scope1.c'::bar::funclocal"] { |
163 gdb_suppress_tests ; | 150 gdb_suppress_tests |
164 } | 151 } |
165 gdb_stop_suppressing_tests; | 152 gdb_stop_suppressing_tests |
166 | 153 |
167 } | 154 } |
168 | 155 |
169 proc test_at_foo {} { | 156 proc test_at_foo {} { |
170 global gdb_prompt | 157 global gdb_prompt |
171 global decimal | 158 global decimal |
172 global det_file | 159 global det_file |
173 global srcdir | 160 global srcdir |
174 global subdir | 161 global subdir |
175 | 162 |
176 if [gdb_test "next" ".*bar \\(\\);" "" ] { | 163 if [gdb_test "next" ".*bar \\(\\);" "" ] { |
177 gdb_suppress_tests ; | 164 gdb_suppress_tests |
178 } | 165 } |
179 | 166 |
180 | 167 |
181 # Print scope0.c::filelocal, which is 1 | 168 # Print scope0.c::filelocal, which is 1 |
182 | 169 |
183 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0
.c'::filelocal at foo" "No symbol \"scope0.c\" in current context.*" "print '$s
rcdir/$subdir/scope0.c'::filelocal"] { | 170 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0
.c'::filelocal at foo" "No symbol \"scope0.c\" in current context.*" "print '$s
rcdir/$subdir/scope0.c'::filelocal"] { |
184 gdb_suppress_tests ; | 171 gdb_suppress_tests |
185 } | 172 } |
186 | 173 |
187 | 174 |
188 # Print scope0.c::filelocal_bss, which is 101 | 175 # Print scope0.c::filelocal_bss, which is 101 |
189 | 176 |
190 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print '
scope0.c'::filelocal_bss in test_at_foo" "No symbol \"scope0.c\" in current con
text.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { | 177 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print '
scope0.c'::filelocal_bss in test_at_foo" "No symbol \"scope0.c\" in current con
text.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { |
191 gdb_suppress_tests ; | 178 gdb_suppress_tests |
192 } | 179 } |
193 | 180 |
194 | 181 |
195 # Print scope0.c::filelocal_ro, which is 201 | 182 # Print scope0.c::filelocal_ro, which is 201 |
196 | 183 |
197 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 184 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
198 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 's
cope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$
srcdir/$subdir/scope0.c'::filelocal_ro"] { | 185 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 's
cope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$
srcdir/$subdir/scope0.c'::filelocal_ro"] { |
199 gdb_suppress_tests ; | 186 gdb_suppress_tests |
200 } | 187 } |
201 | 188 |
202 | 189 |
203 gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo" | 190 gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo" |
204 | 191 |
205 # Print scope1.c::filelocal, which is 2 | 192 # Print scope1.c::filelocal, which is 2 |
206 | 193 |
207 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 194 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
208 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1
.c'::filelocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$s
rcdir/$subdir/scope1.c'::filelocal"] { | 195 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1
.c'::filelocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$s
rcdir/$subdir/scope1.c'::filelocal"] { |
209 gdb_suppress_tests ; | 196 gdb_suppress_tests |
210 } | 197 } |
211 | 198 |
212 | 199 |
213 gdb_test "print filelocal_bss" "\\\$$decimal = 102" \ | 200 gdb_test "print filelocal_bss" "\\\$$decimal = 102" \ |
214 "print filelocal_bss at foo" | 201 "print filelocal_bss at foo" |
215 | 202 |
216 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 203 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
217 gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scop
e1.c'::filelocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "pri
nt '$srcdir/$subdir/scope1.c'::filelocal_bss" | 204 gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scop
e1.c'::filelocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "pri
nt '$srcdir/$subdir/scope1.c'::filelocal_bss" |
218 | 205 |
219 | 206 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print '
scope1.c'::foo::funclocal_ro at foo" "No symbol \"scope1.c\" in current context
.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" | 246 gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print '
scope1.c'::foo::funclocal_ro at foo" "No symbol \"scope1.c\" in current context
.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" |
260 | 247 |
261 | 248 |
262 # Print scope1.c::bar::funclocal, which is 4 | 249 # Print scope1.c::bar::funclocal, which is 4 |
263 | 250 |
264 gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ | 251 gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ |
265 "print bar::funclocal at foo" | 252 "print bar::funclocal at foo" |
266 | 253 |
267 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 254 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
268 gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope
1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "pri
nt '$srcdir/$subdir/scope1.c'::bar::funclocal" | 255 gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope
1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "pri
nt '$srcdir/$subdir/scope1.c'::bar::funclocal" |
269 gdb_stop_suppressing_tests; | 256 gdb_stop_suppressing_tests |
270 | 257 |
271 } | 258 } |
272 | 259 |
273 proc test_at_bar {} { | 260 proc test_at_bar {} { |
274 global gdb_prompt | 261 global gdb_prompt |
275 global decimal | 262 global decimal |
276 global det_file | 263 global det_file |
277 global srcdir | 264 global srcdir |
278 global subdir | 265 global subdir |
279 | 266 |
280 if [gdb_test "next" ".*" "" ] { | 267 if [gdb_test "next" ".*" "" ] { |
281 gdb_suppress_tests ; | 268 gdb_suppress_tests |
282 } | 269 } |
283 | 270 |
284 | 271 |
285 # Print scope0.c::filelocal, which is 1 | 272 # Print scope0.c::filelocal, which is 1 |
286 | 273 |
287 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0
.c'::filelocal at bar" "No symbol \"scope0.c\" in current context.*" "print '$s
rcdir/$subdir/scope0.c'::filelocal"] { | 274 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0
.c'::filelocal at bar" "No symbol \"scope0.c\" in current context.*" "print '$s
rcdir/$subdir/scope0.c'::filelocal"] { |
288 gdb_suppress_tests ; | 275 gdb_suppress_tests |
289 } | 276 } |
290 | 277 |
291 | 278 |
292 # Print scope0.c::filelocal_bss, which is 101 | 279 # Print scope0.c::filelocal_bss, which is 101 |
293 | 280 |
294 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print '
scope0.c'::filelocal_bss in test_at_bar" "No symbol \"scope0.c\" in current con
text.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { | 281 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print '
scope0.c'::filelocal_bss in test_at_bar" "No symbol \"scope0.c\" in current con
text.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { |
295 gdb_suppress_tests ; | 282 gdb_suppress_tests |
296 } | 283 } |
297 | 284 |
298 | 285 |
299 # Print scope0.c::filelocal_ro, which is 201 | 286 # Print scope0.c::filelocal_ro, which is 201 |
300 | 287 |
301 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 288 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
302 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 's
cope0.c'::filelocal_ro at bar" "No symbol \"scope0.c\" in current context.*" "p
rint '$srcdir/$subdir/scope0.c'::filelocal_ro"] { | 289 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 's
cope0.c'::filelocal_ro at bar" "No symbol \"scope0.c\" in current context.*" "p
rint '$srcdir/$subdir/scope0.c'::filelocal_ro"] { |
303 gdb_suppress_tests ; | 290 gdb_suppress_tests |
304 } | 291 } |
305 | 292 |
306 | 293 |
307 # Print scope1.c::filelocal, which is 2 | 294 # Print scope1.c::filelocal, which is 2 |
308 | 295 |
309 if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ]
{ | 296 if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ]
{ |
310 gdb_suppress_tests ; | 297 gdb_suppress_tests |
311 } | 298 } |
312 | 299 |
313 | 300 |
314 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 301 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
315 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1
.c'::filelocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$s
rcdir/$subdir/scope1.c'::filelocal"] { | 302 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1
.c'::filelocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$s
rcdir/$subdir/scope1.c'::filelocal"] { |
316 gdb_suppress_tests ; | 303 gdb_suppress_tests |
317 } | 304 } |
318 | 305 |
319 | 306 |
320 # Print scope1.c::filelocal_bss, which is 102 | 307 # Print scope1.c::filelocal_bss, which is 102 |
321 | 308 |
322 if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss
at bar" ] { | 309 if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss
at bar" ] { |
323 gdb_suppress_tests ; | 310 gdb_suppress_tests |
324 } | 311 } |
325 | 312 |
326 | 313 |
327 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 314 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
328 if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print '
scope1.c'::filelocal_bss at bar" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { | 315 if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print '
scope1.c'::filelocal_bss at bar" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { |
329 gdb_suppress_tests ; | 316 gdb_suppress_tests |
330 } | 317 } |
331 | 318 |
332 | 319 |
333 # Print scope1.c::filelocal_ro, which is 202 | 320 # Print scope1.c::filelocal_ro, which is 202 |
334 | 321 |
335 if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro i
n test_at_bar" ] { | 322 if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro i
n test_at_bar" ] { |
336 gdb_suppress_tests ; | 323 gdb_suppress_tests |
337 } | 324 } |
338 | 325 |
339 | 326 |
340 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 327 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
341 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 's
cope1.c'::filelocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "p
rint '$srcdir/$subdir/scope1.c'::filelocal_ro"] { | 328 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 's
cope1.c'::filelocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "p
rint '$srcdir/$subdir/scope1.c'::filelocal_ro"] { |
342 gdb_suppress_tests ; | 329 gdb_suppress_tests |
343 } | 330 } |
344 | 331 |
345 | 332 |
346 # Print scope1.c::foo::funclocal, which is 3 | 333 # Print scope1.c::foo::funclocal, which is 3 |
347 | 334 |
348 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal
at bar" ] { | 335 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal
at bar" ] { |
349 gdb_suppress_tests ; | 336 gdb_suppress_tests |
350 } | 337 } |
351 | 338 |
352 | 339 |
353 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 340 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
354 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 's
cope1.c'::foo::funclocal at bar" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::foo::funclocal"] { | 341 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 's
cope1.c'::foo::funclocal at bar" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::foo::funclocal"] { |
355 gdb_suppress_tests ; | 342 gdb_suppress_tests |
356 } | 343 } |
357 | 344 |
358 | 345 |
359 # Print scope1.c::foo::funclocal_bss, which is 103 | 346 # Print scope1.c::foo::funclocal_bss, which is 103 |
360 | 347 |
361 if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::fun
clocal_bss at bar" ] { | 348 if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::fun
clocal_bss at bar" ] { |
362 gdb_suppress_tests ; | 349 gdb_suppress_tests |
363 } | 350 } |
364 | 351 |
365 | 352 |
366 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 353 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
367 if [gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "pr
int 'scope1.c'::foo::funclocal_bss at bar" "No symbol \"scope1.c\" in current c
ontext.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"] { | 354 if [gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "pr
int 'scope1.c'::foo::funclocal_bss at bar" "No symbol \"scope1.c\" in current c
ontext.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"] { |
368 gdb_suppress_tests ; | 355 gdb_suppress_tests |
369 } | 356 } |
370 | 357 |
371 | 358 |
372 # Print scope1.c::foo::funclocal_ro, which is 203 | 359 # Print scope1.c::foo::funclocal_ro, which is 203 |
373 | 360 |
374 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::func
local_ro at bar" ] { | 361 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::func
local_ro at bar" ] { |
375 gdb_suppress_tests ; | 362 gdb_suppress_tests |
376 } | 363 } |
377 | 364 |
378 | 365 |
379 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 366 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
380 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "pri
nt 'scope1.c'::foo::funclocal_ro at bar" "No symbol \"scope1.c\" in current con
text.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { | 367 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "pri
nt 'scope1.c'::foo::funclocal_ro at bar" "No symbol \"scope1.c\" in current con
text.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { |
381 gdb_suppress_tests ; | 368 gdb_suppress_tests |
382 } | 369 } |
383 | 370 |
384 | 371 |
385 # Print scope1.c::bar::funclocal, which is 4 | 372 # Print scope1.c::bar::funclocal, which is 4 |
386 | 373 |
387 if [gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" ]
{ | 374 if [gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" ]
{ |
388 gdb_suppress_tests ; | 375 gdb_suppress_tests |
389 } | 376 } |
390 | 377 |
391 | 378 |
392 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal
at bar" ] { | 379 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal
at bar" ] { |
393 gdb_suppress_tests ; | 380 gdb_suppress_tests |
394 } | 381 } |
395 | 382 |
396 | 383 |
397 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 384 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
398 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 's
cope1.c'::bar::funclocal at bar" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::bar::funclocal"] { | 385 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 's
cope1.c'::bar::funclocal at bar" "No symbol \"scope1.c\" in current context.*"
"print '$srcdir/$subdir/scope1.c'::bar::funclocal"] { |
399 gdb_suppress_tests ; | 386 gdb_suppress_tests |
400 } | 387 } |
401 | 388 |
402 | 389 |
403 # Print scope1.c::bar::funclocal_bss, which is 104 | 390 # Print scope1.c::bar::funclocal_bss, which is 104 |
404 | 391 |
405 if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss
at bar" ] { | 392 if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss
at bar" ] { |
406 gdb_suppress_tests ; | 393 gdb_suppress_tests |
407 } | 394 } |
408 | 395 |
409 | 396 |
410 if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::fun
clocal_bss at bar" ] { | 397 if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::fun
clocal_bss at bar" ] { |
411 gdb_suppress_tests ; | 398 gdb_suppress_tests |
412 } | 399 } |
413 | 400 |
414 | 401 |
415 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } | 402 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" } |
416 if [gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "pr
int 'scope1.c'::bar::funclocal_bss at bar" "No symbol \"scope1.c\" in current c
ontext.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss"] { | 403 if [gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "pr
int 'scope1.c'::bar::funclocal_bss at bar" "No symbol \"scope1.c\" in current c
ontext.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss"] { |
417 gdb_suppress_tests ; | 404 gdb_suppress_tests |
418 } | 405 } |
419 gdb_stop_suppressing_tests; | 406 gdb_stop_suppressing_tests |
420 | 407 |
421 } | 408 } |
422 | 409 |
423 # This test has little to do with local scopes, but it is in scope.exp anyway. | 410 # This test has little to do with local scopes, but it is in scope.exp anyway. |
424 # That's life. | 411 # That's life. |
425 | 412 |
426 proc test_at_autovars {} { | 413 proc test_at_autovars {} { |
427 global gdb_prompt | 414 global gdb_prompt |
428 global decimal | 415 global decimal |
429 global hex | 416 global hex |
430 global srcfile | 417 global srcfile |
431 | 418 |
432 # Test symbol table lookup with 100 local (auto) variables. | 419 # Test symbol table lookup with 100 local (auto) variables. |
433 | 420 |
434 gdb_breakpoint marker1 | 421 gdb_breakpoint marker1 |
435 | 422 |
436 if [gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" "continue to m
arker1"] { | 423 if [gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" "continue to m
arker1"] { |
437 » gdb_suppress_tests; | 424 » gdb_suppress_tests |
438 } | 425 } |
439 | 426 |
440 if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] { | 427 if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] { |
441 » gdb_suppress_tests ; | 428 » gdb_suppress_tests |
442 } | 429 } |
443 | 430 |
444 set count 0 | 431 set count 0 |
445 while {$count < 100} { | 432 while {$count < 100} { |
446 if [gdb_test "print i$count" ".* = $count" "" ] { | 433 if [gdb_test "print i$count" ".* = $count" "" ] { |
447 » gdb_suppress_tests ; | 434 » gdb_suppress_tests |
448 } | 435 } |
449 | 436 |
450 set count [expr $count+1] | 437 set count [expr $count+1] |
451 } | 438 } |
452 clear_xfail "*-*-*" | 439 clear_xfail "*-*-*" |
453 pass "$count auto variables correctly initialized" | 440 pass "$count auto variables correctly initialized" |
454 | 441 |
455 # Test that block variable sorting is not screwing us. | 442 # Test that block variable sorting is not screwing us. |
456 gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order" | 443 gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order" |
457 } | 444 } |
458 | 445 |
459 proc test_at_localscopes {} { | 446 proc test_at_localscopes {} { |
460 global gdb_prompt | 447 global gdb_prompt |
461 global decimal | 448 global decimal |
462 global hex | 449 global hex |
463 global srcfile | 450 global srcfile |
464 | 451 |
465 gdb_breakpoint marker2 | 452 gdb_breakpoint marker2 |
466 gdb_breakpoint marker3 | 453 gdb_breakpoint marker3 |
467 gdb_breakpoint marker4 | 454 gdb_breakpoint marker4 |
468 | 455 |
469 if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to m
arker2"] { | 456 if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to m
arker2"] { |
470 » gdb_suppress_tests; | 457 » gdb_suppress_tests |
471 } | 458 } |
472 if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] { | 459 if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] { |
473 » gdb_suppress_tests ; | 460 » gdb_suppress_tests |
474 } | 461 } |
475 | 462 |
476 # Should be at first (outermost) scope. Check values. | 463 # Should be at first (outermost) scope. Check values. |
477 | 464 |
478 gdb_test "print localval" " = 10" "print localval, outer scope" | 465 gdb_test "print localval" " = 10" "print localval, outer scope" |
479 gdb_test "print localval1" " = 11" "print localval1, outer scope" | 466 gdb_test "print localval1" " = 11" "print localval1, outer scope" |
480 gdb_test "print localval2" "No symbol \"localval2\" in current context." \ | 467 gdb_test "print localval2" "No symbol \"localval2\" in current context." \ |
481 "print localval2, outer scope" | 468 "print localval2, outer scope" |
482 gdb_test "print localval3" "No symbol \"localval3\" in current context." \ | 469 gdb_test "print localval3" "No symbol \"localval3\" in current context." \ |
483 "print localval3, outer scope" | 470 "print localval3, outer scope" |
(...skipping 18 matching lines...) Expand all Loading... |
502 if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \ | 489 if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \ |
503 "continue to marker4 in scope.exp"] then { gdb_suppress_tests } | 490 "continue to marker4 in scope.exp"] then { gdb_suppress_tests } |
504 if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] { | 491 if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] { |
505 gdb_suppress_tests | 492 gdb_suppress_tests |
506 } | 493 } |
507 | 494 |
508 gdb_test "print localval" " = 30" "print localval, innermost scope" | 495 gdb_test "print localval" " = 30" "print localval, innermost scope" |
509 gdb_test "print localval1" " = 11" "print localval1, innermost scope" | 496 gdb_test "print localval1" " = 11" "print localval1, innermost scope" |
510 gdb_test "print localval2" " = 12" "print localval2, innermost scope" | 497 gdb_test "print localval2" " = 12" "print localval2, innermost scope" |
511 gdb_test "print localval3" " = 13" "print localval3, innermost scope" | 498 gdb_test "print localval3" " = 13" "print localval3, innermost scope" |
512 gdb_stop_suppressing_tests; | 499 gdb_stop_suppressing_tests |
513 } | 500 } |
514 | 501 |
515 # Start with a fresh gdb. | |
516 | |
517 gdb_exit | |
518 gdb_start | |
519 gdb_reinitialize_dir $srcdir/$subdir | |
520 gdb_load ${binfile} | |
521 | |
522 if [istarget "*-*-vxworks*"] { | 502 if [istarget "*-*-vxworks*"] { |
523 set timeout 120 | 503 set timeout 120 |
524 verbose "Timeout is now $timeout seconds" 2 | 504 verbose "Timeout is now $timeout seconds" 2 |
525 } | 505 } |
526 | 506 |
527 # Test that variables in various segments print out correctly before | 507 # Test that variables in various segments print out correctly before |
528 # the program is run. | 508 # the program is run. |
529 | 509 |
530 # AIX--sections get mapped to the same address so we can't get the right one. | 510 # AIX--sections get mapped to the same address so we can't get the right one. |
531 setup_xfail "rs6000-*-*" | 511 setup_xfail "rs6000-*-*" |
(...skipping 22 matching lines...) Expand all Loading... |
554 if [runto_main] then { test_at_main } | 534 if [runto_main] then { test_at_main } |
555 if [runto foo] then { test_at_foo } | 535 if [runto foo] then { test_at_foo } |
556 if [runto bar] then { test_at_bar } | 536 if [runto bar] then { test_at_bar } |
557 if [runto localscopes] then { test_at_localscopes } | 537 if [runto localscopes] then { test_at_localscopes } |
558 if [runto autovars] then { test_at_autovars } | 538 if [runto autovars] then { test_at_autovars } |
559 | 539 |
560 if [istarget "*-*-vxworks*"] { | 540 if [istarget "*-*-vxworks*"] { |
561 set timeout 120 | 541 set timeout 120 |
562 verbose "Timeout is now $timeout seconds" 2 | 542 verbose "Timeout is now $timeout seconds" 2 |
563 } | 543 } |
OLD | NEW |