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