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