]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/scope.exp
Update Copyright year range in all files maintained by GDB.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / scope.exp
CommitLineData
ecd75fc8 1# Copyright 1992-2014 Free Software Foundation, Inc.
c906108c
SS
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
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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#
c906108c 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/>.
c906108c 15
c906108c
SS
16# This file was written by Fred Fish. (fnf@cygnus.com)
17
c906108c 18
0ab77f5f 19standard_testfile scope0.c scope1.c
c906108c 20
0ab77f5f
TT
21if {[prepare_for_testing ${testfile}.exp ${testfile} \
22 [list $srcfile $srcfile2] {debug}]} {
23 return -1
c906108c
SS
24}
25
26# Create and source the file that provides information about the compiler
27# used to compile the test case.
4c93b1db 28if [get_compiler_info] {
ae59b1da 29 return -1
c906108c
SS
30}
31
32# Test locating various things when stopped just inside main, after
33# running init0(). To prevent cascading of errors, we report the
34# first one and quit. If all pass, then we print the pass results.
35
36proc test_at_main {} {
37 global gdb_prompt
38 global decimal
39 global det_file
40 global srcdir
41 global subdir
085dd6e6 42 global hp_cc_compiler
c906108c 43
34e41e63
JB
44 # skip past init0.
45 # This used to do an extra "next" if the first one didn't get us
46 # over the call to init0, to handle calls to __main in the
47 # prologue, etc. But if a breakpoint at main doesn't leave us on
48 # the first line of real code in the function, that's a GDB bug.
49 gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main"
c906108c
SS
50
51 # Print scope0.c::filelocal, which is 1
52
53 if [gdb_test "print filelocal" "\\\$$decimal = 1" "print filelocal" ] {
4ec70201 54 gdb_suppress_tests
c906108c
SS
55 }
56
57
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"] {
4ec70201 59 gdb_suppress_tests
c906108c
SS
60 }
61
62
63 # Print scope0.c::filelocal_bss, which is 101
64
65 if [gdb_test "print filelocal_bss" "\\\$$decimal = 101" "print filelocal_bss" ] {
4ec70201 66 gdb_suppress_tests
c906108c
SS
67 }
68
69
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 context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] {
4ec70201 71 gdb_suppress_tests
c906108c
SS
72 }
73
74
75 # Print scope0.c::filelocal_ro, which is 201
76
15656118 77 # No clue why the rs6000 fails this test.
ba9b20a7 78 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 79 if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" ] {
4ec70201 80 gdb_suppress_tests
c906108c
SS
81 }
82
83
ba9b20a7 84 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 85 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] {
4ec70201 86 gdb_suppress_tests
c906108c
SS
87 }
88
89
90 # Print scope1.c::filelocal, which is 2
91
ba9b20a7 92 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 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"] {
4ec70201 94 gdb_suppress_tests
c906108c
SS
95 }
96
97
98 # Print scope1.c::filelocal_bss, which is 102
99
ba9b20a7 100 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 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"] {
4ec70201 102 gdb_suppress_tests
c906108c
SS
103 }
104
105
106 # Print scope1.c::filelocal_ro, which is 202
107
ba9b20a7 108 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
a0b3c4fd 109 if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs}
c906108c 110 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] {
4ec70201 111 gdb_suppress_tests
c906108c
SS
112 }
113
114
115 # Print scope1.c::foo::funclocal, which is 3
116
c906108c 117 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal" ] {
4ec70201 118 gdb_suppress_tests
c906108c
SS
119 }
120
121
ba9b20a7 122 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 123 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] {
4ec70201 124 gdb_suppress_tests
c906108c
SS
125 }
126
127
128 # Print scope1.c::foo::funclocal_ro, which is 203
129
130 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro" ] {
4ec70201 131 gdb_suppress_tests
c906108c
SS
132 }
133
134
ba9b20a7 135 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 136 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] {
4ec70201 137 gdb_suppress_tests
c906108c
SS
138 }
139
140
141 # Print scope1.c::bar::funclocal, which is 4
142
143 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal" ] {
4ec70201 144 gdb_suppress_tests
c906108c
SS
145 }
146
147
ba9b20a7 148 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 149 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] {
4ec70201 150 gdb_suppress_tests
c906108c 151 }
4ec70201 152 gdb_stop_suppressing_tests
c906108c
SS
153
154}
155
156proc test_at_foo {} {
157 global gdb_prompt
158 global decimal
159 global det_file
160 global srcdir
161 global subdir
c906108c
SS
162
163 if [gdb_test "next" ".*bar \\(\\);" "" ] {
4ec70201 164 gdb_suppress_tests
c906108c
SS
165 }
166
167
168 # Print scope0.c::filelocal, which is 1
169
170 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at foo" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] {
4ec70201 171 gdb_suppress_tests
c906108c
SS
172 }
173
174
175 # Print scope0.c::filelocal_bss, which is 101
176
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 context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] {
4ec70201 178 gdb_suppress_tests
c906108c
SS
179 }
180
181
182 # Print scope0.c::filelocal_ro, which is 201
183
ba9b20a7 184 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 185 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] {
4ec70201 186 gdb_suppress_tests
c906108c
SS
187 }
188
189
190 gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo"
191
192 # Print scope1.c::filelocal, which is 2
193
ba9b20a7 194 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 195 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] {
4ec70201 196 gdb_suppress_tests
c906108c
SS
197 }
198
199
200 gdb_test "print filelocal_bss" "\\\$$decimal = 102" \
201 "print filelocal_bss at foo"
202
ba9b20a7 203 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c
SS
204 gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"
205
206
207 gdb_test "print filelocal_ro" "\\\$$decimal = 202" \
208 "print filelocal_ro at foo"
209
ba9b20a7 210 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c
SS
211 gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"
212
213
214 # Print scope1.c::foo::funclocal, which is 3
215
216 gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo"
217
c906108c
SS
218 gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
219 "print foo::funclocal at foo"
220
ba9b20a7 221 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c
SS
222 gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"
223
224
225 # Print scope1.c::foo::funclocal_bss, which is 103
226
227 gdb_test "print funclocal_bss" "\\\$$decimal = 103" \
228 "print funclocal_bss at foo"
229
c906108c
SS
230 gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
231 "print foo::funclocal_bss at foo"
232
ba9b20a7 233 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c
SS
234 gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"
235
236
237 # Print scope1.c::foo::funclocal_ro, which is 203
238
239 gdb_test "print funclocal_ro" "\\\$$decimal = 203" \
240 "print funclocal_ro at foo"
241
c906108c
SS
242 gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
243 "print foo::funclocal_ro at foo"
244
ba9b20a7 245 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c
SS
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"
247
248
249 # Print scope1.c::bar::funclocal, which is 4
250
c906108c
SS
251 gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
252 "print bar::funclocal at foo"
253
ba9b20a7 254 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 255 gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"
4ec70201 256 gdb_stop_suppressing_tests
c906108c
SS
257
258}
259
260proc test_at_bar {} {
261 global gdb_prompt
262 global decimal
263 global det_file
264 global srcdir
265 global subdir
c906108c
SS
266
267 if [gdb_test "next" ".*" "" ] {
4ec70201 268 gdb_suppress_tests
c906108c
SS
269 }
270
271
272 # Print scope0.c::filelocal, which is 1
273
274 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] {
4ec70201 275 gdb_suppress_tests
c906108c
SS
276 }
277
278
279 # Print scope0.c::filelocal_bss, which is 101
280
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 context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] {
4ec70201 282 gdb_suppress_tests
c906108c
SS
283 }
284
285
286 # Print scope0.c::filelocal_ro, which is 201
287
ba9b20a7 288 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 289 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] {
4ec70201 290 gdb_suppress_tests
c906108c
SS
291 }
292
293
294 # Print scope1.c::filelocal, which is 2
295
296 if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ] {
4ec70201 297 gdb_suppress_tests
c906108c
SS
298 }
299
300
ba9b20a7 301 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 302 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] {
4ec70201 303 gdb_suppress_tests
c906108c
SS
304 }
305
306
307 # Print scope1.c::filelocal_bss, which is 102
308
309 if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar" ] {
4ec70201 310 gdb_suppress_tests
c906108c
SS
311 }
312
313
ba9b20a7 314 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 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"] {
4ec70201 316 gdb_suppress_tests
c906108c
SS
317 }
318
319
320 # Print scope1.c::filelocal_ro, which is 202
321
322 if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar" ] {
4ec70201 323 gdb_suppress_tests
c906108c
SS
324 }
325
326
ba9b20a7 327 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 328 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] {
4ec70201 329 gdb_suppress_tests
c906108c
SS
330 }
331
332
333 # Print scope1.c::foo::funclocal, which is 3
334
c906108c 335 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] {
4ec70201 336 gdb_suppress_tests
c906108c
SS
337 }
338
339
ba9b20a7 340 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 341 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] {
4ec70201 342 gdb_suppress_tests
c906108c
SS
343 }
344
345
346 # Print scope1.c::foo::funclocal_bss, which is 103
347
348 if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar" ] {
4ec70201 349 gdb_suppress_tests
c906108c
SS
350 }
351
352
ba9b20a7 353 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 354 if [gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"] {
4ec70201 355 gdb_suppress_tests
c906108c
SS
356 }
357
358
359 # Print scope1.c::foo::funclocal_ro, which is 203
360
361 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar" ] {
4ec70201 362 gdb_suppress_tests
c906108c
SS
363 }
364
365
ba9b20a7 366 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 367 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] {
4ec70201 368 gdb_suppress_tests
c906108c
SS
369 }
370
371
372 # Print scope1.c::bar::funclocal, which is 4
373
374 if [gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" ] {
4ec70201 375 gdb_suppress_tests
c906108c
SS
376 }
377
378
379 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar" ] {
4ec70201 380 gdb_suppress_tests
c906108c
SS
381 }
382
383
ba9b20a7 384 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 385 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] {
4ec70201 386 gdb_suppress_tests
c906108c
SS
387 }
388
389
390 # Print scope1.c::bar::funclocal_bss, which is 104
391
392 if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar" ] {
4ec70201 393 gdb_suppress_tests
c906108c
SS
394 }
395
396
397 if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar" ] {
4ec70201 398 gdb_suppress_tests
c906108c
SS
399 }
400
401
ba9b20a7 402 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
c906108c 403 if [gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "print 'scope1.c'::bar::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss"] {
4ec70201 404 gdb_suppress_tests
c906108c 405 }
4ec70201 406 gdb_stop_suppressing_tests
c906108c
SS
407
408}
409
410# This test has little to do with local scopes, but it is in scope.exp anyway.
411# That's life.
412
413proc test_at_autovars {} {
414 global gdb_prompt
415 global decimal
416 global hex
417 global srcfile
418
419 # Test symbol table lookup with 100 local (auto) variables.
420
421 gdb_breakpoint marker1
422
423 if [gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" "continue to marker1"] {
4ec70201 424 gdb_suppress_tests
c906108c
SS
425 }
426
660fd469 427 if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] {
4ec70201 428 gdb_suppress_tests
c906108c
SS
429 }
430
431 set count 0
432 while {$count < 100} {
433 if [gdb_test "print i$count" ".* = $count" "" ] {
4ec70201 434 gdb_suppress_tests
c906108c
SS
435 }
436
437 set count [expr $count+1]
438 }
439 clear_xfail "*-*-*"
440 pass "$count auto variables correctly initialized"
441
442 # Test that block variable sorting is not screwing us.
443 gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order"
444}
445
446proc test_at_localscopes {} {
447 global gdb_prompt
448 global decimal
449 global hex
450 global srcfile
451
452 gdb_breakpoint marker2
453 gdb_breakpoint marker3
454 gdb_breakpoint marker4
455
456 if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to marker2"] {
4ec70201 457 gdb_suppress_tests
c906108c 458 }
660fd469 459 if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] {
4ec70201 460 gdb_suppress_tests
c906108c
SS
461 }
462
463 # Should be at first (outermost) scope. Check values.
464
465 gdb_test "print localval" " = 10" "print localval, outer scope"
466 gdb_test "print localval1" " = 11" "print localval1, outer scope"
467 gdb_test "print localval2" "No symbol \"localval2\" in current context." \
468 "print localval2, outer scope"
469 gdb_test "print localval3" "No symbol \"localval3\" in current context." \
470 "print localval3, outer scope"
471
472 if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \
473 "continue to marker3 in scope.exp"] then { gdb_suppress_tests }
660fd469
MS
474 if [gdb_test "up" ".*localscopes.*" "up from marker3 in scope.exp"] {
475 gdb_suppress_tests
476 }
c906108c
SS
477
478 # Should be at next (first nested) scope. Check values.
479
480 gdb_test "print localval" " = 20" \
481 "print localval, first nested scope"
482 gdb_test "print localval1" " = 11" "print localval1, first nested scope"
483 gdb_test "print localval2" " = 12" "print localval2, first nested scope"
484 gdb_test "print localval3" "No symbol \"localval3\" in current context." \
485 "print localval3, first nested scope"
486
487 # This test will only fail if the file was compiled by gcc, but
488 # there's no way to check that.
c906108c
SS
489 if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \
490 "continue to marker4 in scope.exp"] then { gdb_suppress_tests }
660fd469
MS
491 if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] {
492 gdb_suppress_tests
493 }
c906108c
SS
494
495 gdb_test "print localval" " = 30" "print localval, innermost scope"
496 gdb_test "print localval1" " = 11" "print localval1, innermost scope"
497 gdb_test "print localval2" " = 12" "print localval2, innermost scope"
498 gdb_test "print localval3" " = 13" "print localval3, innermost scope"
4ec70201 499 gdb_stop_suppressing_tests
c906108c
SS
500}
501
c906108c
SS
502if [istarget "*-*-vxworks*"] {
503 set timeout 120
504 verbose "Timeout is now $timeout seconds" 2
505}
506
507# Test that variables in various segments print out correctly before
508# the program is run.
509
510# AIX--sections get mapped to the same address so we can't get the right one.
511setup_xfail "rs6000-*-*"
c906108c
SS
512
513gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
514
515# gdb currently cannot access bss memory on some targets if the inferior
516# is not running.
517#
518# For PA boards using monitor/remote-pa.c, the bss test is going to
519# randomly fail. We've already put remote-pa on the target stack,
520# so we actually read memory from the board. Problem is crt0.o
521# is responsible for clearing bss and that hasnt' happened yet.
522#
523# This is a problem for all non-native targets. -- manson
676a0442 524if [is_remote target] {
c906108c
SS
525 unsupported "print 'scope0.c'::filelocal_bss before run"
526} else {
527 gdb_test "print 'scope0.c'::filelocal_bss" "= 0" \
528 "print 'scope0.c'::filelocal_bss before run"
529}
530
531gdb_test "print 'scope0.c'::filelocal" "= 1" \
532 "print 'scope0.c'::filelocal before run"
533
534if [runto_main] then { test_at_main }
c906108c 535if [runto foo] then { test_at_foo }
c906108c 536if [runto bar] then { test_at_bar }
c906108c 537if [runto localscopes] then { test_at_localscopes }
c906108c
SS
538if [runto autovars] then { test_at_autovars }
539
540if [istarget "*-*-vxworks*"] {
541 set timeout 120
542 verbose "Timeout is now $timeout seconds" 2
543}