Commit | Line | Data |
---|---|---|
4081daa1 | 1 | # Copyright (C) 1992, 1994 Free Software Foundation, Inc. |
ef44eed1 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 | |
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 | |
5c6f833b | 15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
ef44eed1 SS |
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 | ||
22 | if $tracelevel then { | |
23 | strace $tracelevel | |
24 | } | |
25 | ||
26 | set prms_id 0 | |
27 | set bug_id 0 | |
28 | ||
29 | set binfile "scope" | |
30 | set srcfile $binfile.c | |
31 | ||
32 | if ![file exists $objdir/$subdir/$binfile] then { | |
33 | perror "$objdir/$subdir/$binfile does not exist." | |
34 | return 0 | |
35 | } | |
36 | ||
ce102e96 FF |
37 | source gdb.base/scope0.ci |
38 | ||
ef44eed1 SS |
39 | # Test locating various things when stopped just inside main, after |
40 | # running init(). To prevent cascading of errors, we report the | |
41 | # first one and quit. If all pass, then we print the pass results. | |
42 | ||
43 | proc test_at_main {} { | |
44 | global prompt | |
45 | global decimal | |
46 | global det_file | |
47 | global srcdir | |
48 | global subdir | |
ce102e96 | 49 | global gcc_compiled |
ef44eed1 | 50 | |
ef44eed1 SS |
51 | # skip past init. There may be a call to __main at the start of |
52 | # main, so the first next may only get us to the init call. | |
53 | send "next\n" | |
54 | expect { | |
6e131ad8 | 55 | -re "$decimal.*foo \\(\\);\r\n$prompt $" { |
4081daa1 JK |
56 | pass "next over init() in main" |
57 | } | |
6e131ad8 | 58 | -re "$decimal.*init \\(\\);\r\n$prompt $"\ |
ef44eed1 SS |
59 | { send "next\n" ; exp_continue } |
60 | -re "$prompt $" { fail "next over init() in main" ; return } | |
61 | timeout { fail "(timeout) next over init() in main" ; return } | |
62 | } | |
63 | ||
64 | # Print scope0.c::filelocal, which is 1 | |
65 | ||
66 | send "print filelocal\n" | |
67 | expect { | |
4081daa1 | 68 | -re "\\\$$decimal = 1\r\n$prompt $" { pass "print filelocal" } |
ef44eed1 SS |
69 | -re "$prompt $" { fail "print filelocal" ; return } |
70 | timeout { | |
71 | fail "(timeout) print filelocal" ; return | |
72 | } | |
73 | } | |
74 | ||
ef44eed1 SS |
75 | send "print 'scope0.c'::filelocal\n" |
76 | expect { | |
4081daa1 JK |
77 | -re "\\\$$decimal = 1\r\n$prompt $" { |
78 | pass "print 'scope0.c'::filelocal at main" | |
79 | } | |
ef44eed1 SS |
80 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
81 | send "print '$srcdir/$subdir/scope0.c'::filelocal\n" | |
82 | exp_continue | |
83 | } | |
4081daa1 | 84 | -re "$prompt $" { fail "print 'scope0.c'::filelocal at main" ; return } |
ef44eed1 | 85 | timeout { |
4081daa1 | 86 | fail "(timeout) print 'scope0.c'::filelocal at main" ; return |
ef44eed1 SS |
87 | } |
88 | } | |
89 | ||
90 | # Print scope0.c::filelocal_bss, which is 101 | |
91 | ||
92 | send "print filelocal_bss\n" | |
93 | expect { | |
4081daa1 JK |
94 | -re "\\\$$decimal = 101\r\n$prompt $" { |
95 | pass "print filelocal_bss" | |
96 | } | |
97 | -re "$prompt $" { fail "print filelocal_bss" ; return } | |
ef44eed1 SS |
98 | timeout { |
99 | fail "(timeout) print filelocal_bss" ; return | |
100 | } | |
101 | } | |
102 | ||
ef44eed1 SS |
103 | send "print 'scope0.c'::filelocal_bss\n" |
104 | expect { | |
4081daa1 | 105 | -re "\\\$$decimal = 101\r\n$prompt $" { |
6e131ad8 | 106 | pass "print 'scope0.c'::filelocal_bss in test_at_main" |
4081daa1 | 107 | } |
ef44eed1 SS |
108 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
109 | send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" | |
110 | exp_continue | |
111 | } | |
6e131ad8 JK |
112 | -re "$prompt $" { |
113 | fail "print 'scope0.c'::filelocal_bss in test_at_main" ; return | |
114 | } | |
ef44eed1 | 115 | timeout { |
6e131ad8 JK |
116 | fail "(timeout) print 'scope0.c'::filelocal_bss in test_at_main" |
117 | return | |
ef44eed1 SS |
118 | } |
119 | } | |
120 | ||
121 | # Print scope0.c::filelocal_ro, which is 201 | |
122 | ||
5c6f833b JL |
123 | # No clue why the powerpc fails this test. |
124 | setup_xfail "powerpc-*-*" | |
ce102e96 | 125 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
126 | send "print filelocal_ro\n" |
127 | expect { | |
ce102e96 FF |
128 | -re "\\\$$decimal = 201\r\n$prompt $" { |
129 | pass "print filelocal_ro in test_at_main" | |
130 | } | |
131 | -re "$prompt $" { | |
132 | fail "print filelocal_ro in test_at_main" | |
133 | return | |
134 | } | |
ef44eed1 | 135 | timeout { |
ce102e96 FF |
136 | fail "(timeout) print filelocal_ro in test_at_main" |
137 | return | |
ef44eed1 SS |
138 | } |
139 | } | |
140 | ||
ce102e96 | 141 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
5c6f833b | 142 | setup_xfail "powerpc-*-*" |
ef44eed1 SS |
143 | send "print 'scope0.c'::filelocal_ro\n" |
144 | expect { | |
4081daa1 JK |
145 | -re "\\\$$decimal = 201\r\n$prompt $" { |
146 | pass "print 'scope0.c'::filelocal_ro" | |
147 | } | |
ef44eed1 SS |
148 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
149 | send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" | |
150 | exp_continue | |
151 | } | |
152 | -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return } | |
153 | timeout { | |
154 | fail "(timeout) print 'scope0.c'::filelocal_ro" ; return | |
155 | } | |
156 | } | |
157 | ||
158 | # Print scope1.c::filelocal, which is 2 | |
159 | ||
ce102e96 | 160 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
161 | send "print 'scope1.c'::filelocal\n" |
162 | expect { | |
4081daa1 JK |
163 | -re "\\\$$decimal = 2\r\n$prompt $" { |
164 | pass "print 'scope1.c'::filelocal" | |
165 | } | |
ef44eed1 SS |
166 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
167 | send "print '$srcdir/$subdir/scope1.c'::filelocal\n" | |
168 | exp_continue | |
169 | } | |
170 | -re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return } | |
171 | timeout { | |
172 | fail "(timeout) print 'scope1.c'::filelocal" ; return | |
173 | } | |
174 | } | |
175 | ||
176 | # Print scope1.c::filelocal_bss, which is 102 | |
177 | ||
ce102e96 | 178 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
179 | send "print 'scope1.c'::filelocal_bss\n" |
180 | expect { | |
4081daa1 JK |
181 | -re "\\\$$decimal = 102\r\n$prompt $" { |
182 | pass "print 'scope1.c'::filelocal_bss" | |
183 | } | |
ef44eed1 SS |
184 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
185 | send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" | |
186 | exp_continue | |
187 | } | |
188 | -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return } | |
189 | timeout { | |
190 | fail "(timeout) print 'scope1.c'::filelocal_bss" ; return | |
191 | } | |
192 | } | |
193 | ||
194 | # Print scope1.c::filelocal_ro, which is 202 | |
195 | ||
ce102e96 | 196 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
197 | send "print 'scope1.c'::filelocal_ro\n" |
198 | expect { | |
4081daa1 JK |
199 | -re "\\\$$decimal = 202\r\n$prompt $" { |
200 | pass "print 'scope1.c'::filelocal_ro" | |
201 | } | |
ef44eed1 SS |
202 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
203 | send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" | |
204 | exp_continue | |
205 | } | |
206 | -re "$prompt " {fail "print 'scope1.c'::filelocal_ro" ; return } | |
207 | timeout { | |
208 | fail "(timeout) print 'scope1.c'::filelocal_ro" ; return | |
209 | } | |
210 | } | |
211 | ||
212 | # Print scope1.c::foo::funclocal, which is 3 | |
213 | ||
ef44eed1 SS |
214 | send "print foo::funclocal\n" |
215 | expect { | |
4081daa1 | 216 | -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" } |
ef44eed1 SS |
217 | -re "$prompt $" { fail "print foo::funclocal" ; return } |
218 | timeout { | |
219 | fail "(timeout) print foo::funclocal" ; return | |
220 | } | |
221 | } | |
222 | ||
ce102e96 | 223 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
224 | send "print 'scope1.c'::foo::funclocal\n" |
225 | expect { | |
4081daa1 JK |
226 | -re "\\\$$decimal = 3\r\n$prompt $" { |
227 | pass "print 'scope1.c'::foo::funclocal" | |
228 | } | |
ef44eed1 SS |
229 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
230 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" | |
231 | exp_continue | |
232 | } | |
233 | -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return } | |
234 | timeout { | |
235 | fail "(timeout) print 'scope1.c'::foo::funclocal" ; return | |
236 | } | |
237 | } | |
238 | ||
239 | # Print scope1.c::foo::funclocal_ro, which is 203 | |
240 | ||
241 | send "print foo::funclocal_ro\n" | |
242 | expect { | |
4081daa1 JK |
243 | -re "\\\$$decimal = 203\r\n$prompt $" { |
244 | pass "print foo::funclocal_ro" | |
245 | } | |
ef44eed1 SS |
246 | -re "$prompt $" { fail "print foo::funclocal_ro" ; return } |
247 | timeout { | |
248 | fail "(timeout) print foo::funclocal_ro" ; return | |
249 | } | |
250 | } | |
251 | ||
ce102e96 | 252 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
253 | send "print 'scope1.c'::foo::funclocal_ro\n" |
254 | expect { | |
4081daa1 JK |
255 | -re "\\\$$decimal = 203\r\n$prompt $" { |
256 | pass "print 'scope1.c'::foo::funclocal_ro" } | |
ef44eed1 SS |
257 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
258 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" | |
259 | exp_continue | |
260 | } | |
261 | -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return } | |
262 | timeout { | |
263 | fail "(timeout) print 'scope1.c'::foo::funclocal_ro" ; return | |
264 | } | |
265 | } | |
266 | ||
267 | # Print scope1.c::bar::funclocal, which is 4 | |
268 | ||
269 | send "print bar::funclocal\n" | |
270 | expect { | |
4081daa1 | 271 | -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" } |
ef44eed1 SS |
272 | -re "$prompt $" { fail "print bar::funclocal" ; return } |
273 | timeout { | |
274 | fail "(timeout) print bar::funclocal" ; return | |
275 | } | |
276 | } | |
277 | ||
ce102e96 | 278 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
279 | send "print 'scope1.c'::bar::funclocal\n" |
280 | expect { | |
4081daa1 JK |
281 | -re "\\\$$decimal = 4\r\n$prompt $" { |
282 | pass "print 'scope1.c'::bar::funclocal" | |
283 | } | |
ef44eed1 SS |
284 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
285 | send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" | |
286 | exp_continue | |
287 | } | |
288 | -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return } | |
289 | timeout { | |
290 | fail "print 'scope1.c'::bar::funclocal" ; return | |
291 | } | |
292 | } | |
ef44eed1 SS |
293 | } |
294 | ||
295 | proc test_at_foo {} { | |
296 | global prompt | |
297 | global decimal | |
298 | global det_file | |
299 | global srcdir | |
300 | global subdir | |
ce102e96 | 301 | global gcc_compiled |
ef44eed1 | 302 | |
ef44eed1 SS |
303 | send "next\n" |
304 | expect { | |
6e131ad8 | 305 | -re ".*bar \\(\\);\r\n$prompt $" {} |
ef44eed1 SS |
306 | -re "$prompt $" { fail "continue to foo()" ; return } |
307 | timeout { fail "(timeout) continue to foo()" ; return } | |
308 | } | |
309 | ||
310 | # Print scope0.c::filelocal, which is 1 | |
311 | ||
ef44eed1 SS |
312 | send "print 'scope0.c'::filelocal\n" |
313 | expect { | |
4081daa1 JK |
314 | -re "\\\$$decimal = 1\r\n$prompt $" { |
315 | pass "print 'scope0.c'::filelocal at foo" | |
316 | } | |
ef44eed1 SS |
317 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
318 | send "print '$srcdir/$subdir/scope0.c'::filelocal\n" | |
319 | exp_continue | |
320 | } | |
4081daa1 | 321 | -re "$prompt $" { fail "print 'scope0.c'::filelocal at foo" ; return } |
ef44eed1 | 322 | timeout { |
4081daa1 | 323 | fail "(timeout) print 'scope0.c'::filelocal at foo" ; return |
ef44eed1 SS |
324 | } |
325 | } | |
326 | ||
5c6f833b | 327 | # Print scope0.c::filelocal_bss, which is 101 |
ef44eed1 | 328 | |
ef44eed1 SS |
329 | send "print 'scope0.c'::filelocal_bss\n" |
330 | expect { | |
6e131ad8 JK |
331 | -re "\\\$$decimal = 101\r\n$prompt $" { |
332 | pass "print 'scope0.c'::filelocal_bss in test_at_foo" | |
333 | } | |
ef44eed1 SS |
334 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
335 | send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" | |
336 | exp_continue | |
337 | } | |
6e131ad8 JK |
338 | -re "$prompt $" { |
339 | fail "print 'scope0.c'::filelocal_bss in test_at_foo" | |
340 | return | |
341 | } | |
ef44eed1 | 342 | timeout { |
6e131ad8 JK |
343 | fail "(timeout) print 'scope0.c'::filelocal_bss in test_at_foo" |
344 | return | |
ef44eed1 SS |
345 | } |
346 | } | |
347 | ||
5c6f833b | 348 | # Print scope0.c::filelocal_ro, which is 201 |
ef44eed1 | 349 | |
ce102e96 | 350 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
5c6f833b | 351 | setup_xfail "powerpc-*-*" |
ef44eed1 SS |
352 | send "print 'scope0.c'::filelocal_ro\n" |
353 | expect { | |
4081daa1 | 354 | -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" } |
ef44eed1 SS |
355 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
356 | send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" | |
357 | exp_continue | |
358 | } | |
359 | -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return } | |
360 | timeout { | |
361 | fail "(timeout) print 'scope0.c'::filelocal_ro" ; return | |
362 | } | |
363 | } | |
364 | ||
5c6f833b | 365 | gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo" |
ef44eed1 | 366 | |
5c6f833b | 367 | # Print scope1.c::filelocal, which is 2 |
ef44eed1 | 368 | |
ce102e96 | 369 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
370 | send "print 'scope1.c'::filelocal\n" |
371 | expect { | |
5c6f833b JL |
372 | -re "\\\$$decimal = 2\r\n$prompt $" { |
373 | pass "print 'scope1.c'::filelocal at foo" | |
374 | } | |
ef44eed1 SS |
375 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
376 | send "print '$srcdir/$subdir/scope1.c'::filelocal\n" | |
377 | exp_continue | |
378 | } | |
5c6f833b | 379 | -re "$prompt $" { fail "print 'scope1.c'::filelocal at foo" ; return } |
ef44eed1 | 380 | timeout { |
5c6f833b | 381 | fail "(timeout) print 'scope1.c'::filelocal at foo" ; return |
ef44eed1 SS |
382 | } |
383 | } | |
384 | ||
5c6f833b JL |
385 | gdb_test "print filelocal_bss" "\\\$$decimal = 102" \ |
386 | "print filelocal_bss at foo" | |
ef44eed1 | 387 | |
ce102e96 | 388 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
389 | send "print 'scope1.c'::filelocal_bss\n" |
390 | expect { | |
5c6f833b JL |
391 | -re "\\\$$decimal = 102\r\n$prompt $" { |
392 | pass "print 'scope1.c'::filelocal_bss at foo" | |
393 | } | |
ef44eed1 SS |
394 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
395 | send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" | |
396 | exp_continue | |
397 | } | |
5c6f833b | 398 | -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss at foo" } |
ef44eed1 | 399 | timeout { |
5c6f833b | 400 | fail "(timeout) print 'scope1.c'::filelocal_bss at foo" |
ef44eed1 SS |
401 | } |
402 | } | |
403 | ||
5c6f833b JL |
404 | gdb_test "print filelocal_ro" "\\\$$decimal = 202" \ |
405 | "print filelocal_ro at foo" | |
ef44eed1 | 406 | |
ce102e96 | 407 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
408 | send "print 'scope1.c'::filelocal_ro\n" |
409 | expect { | |
5c6f833b | 410 | -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro at foo" } |
ef44eed1 SS |
411 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
412 | send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" | |
413 | exp_continue | |
414 | } | |
5c6f833b | 415 | -re "$prompt $" { fail "print 'scope1.c'::filelocal_ro at foo" } |
ef44eed1 | 416 | timeout { |
5c6f833b | 417 | fail "(timeout) print 'scope1.c'::filelocal_ro at foo" |
ef44eed1 SS |
418 | } |
419 | } | |
420 | ||
421 | # Print scope1.c::foo::funclocal, which is 3 | |
422 | ||
5c6f833b | 423 | gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo" |
ef44eed1 | 424 | |
5c6f833b JL |
425 | gdb_test "print foo::funclocal" "\\\$$decimal = 3" \ |
426 | "print foo::funclocal at foo" | |
ef44eed1 | 427 | |
ce102e96 | 428 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
429 | send "print 'scope1.c'::foo::funclocal\n" |
430 | expect { | |
5c6f833b JL |
431 | -re "\\\$$decimal = 3\r\n$prompt $" { |
432 | pass "print 'scope1.c'::foo::funclocal at foo" | |
433 | } | |
ef44eed1 SS |
434 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
435 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" | |
436 | exp_continue | |
437 | } | |
5c6f833b | 438 | -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal at foo" } |
ef44eed1 | 439 | timeout { |
5c6f833b | 440 | fail "(timeout) print 'scope1.c'::foo::funclocal at foo" |
ef44eed1 SS |
441 | } |
442 | } | |
443 | ||
444 | # Print scope1.c::foo::funclocal_bss, which is 103 | |
445 | ||
5c6f833b JL |
446 | gdb_test "print funclocal_bss" "\\\$$decimal = 103" \ |
447 | "print funclocal_bss at foo" | |
ef44eed1 | 448 | |
5c6f833b JL |
449 | gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \ |
450 | "print foo::funclocal_bss at foo" | |
ef44eed1 | 451 | |
ce102e96 | 452 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
453 | send "print 'scope1.c'::foo::funclocal_bss\n" |
454 | expect { | |
5c6f833b JL |
455 | -re "\\\$$decimal = 103\r\n$prompt $" { |
456 | pass "print 'scope1.c'::foo::funclocal_bss at foo" | |
457 | } | |
ef44eed1 SS |
458 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
459 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n" | |
460 | exp_continue | |
461 | } | |
5c6f833b JL |
462 | -re "$prompt $" { |
463 | fail "print 'scope1.c'::foo::funclocal_bss at foo" | |
464 | } | |
ef44eed1 | 465 | timeout { |
5c6f833b | 466 | fail "(timeout) print 'scope1.c'::foo::funclocal_bss at foo" |
ef44eed1 SS |
467 | } |
468 | } | |
469 | ||
470 | # Print scope1.c::foo::funclocal_ro, which is 203 | |
471 | ||
5c6f833b JL |
472 | gdb_test "print funclocal_ro" "\\\$$decimal = 203" \ |
473 | "print funclocal_ro at foo" | |
ef44eed1 | 474 | |
5c6f833b JL |
475 | gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \ |
476 | "print foo::funclocal_ro at foo" | |
ef44eed1 | 477 | |
ce102e96 | 478 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
479 | send "print 'scope1.c'::foo::funclocal_ro\n" |
480 | expect { | |
5c6f833b JL |
481 | -re "\\\$$decimal = 203\r\n$prompt $" { |
482 | pass "print 'scope1.c'::foo::funclocal_ro at foo" | |
483 | } | |
ef44eed1 SS |
484 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
485 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" | |
486 | exp_continue | |
487 | } | |
5c6f833b | 488 | -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro at foo" } |
ef44eed1 | 489 | timeout { |
5c6f833b | 490 | fail "(timeout) print 'scope1.c'::foo::funclocal_ro at foo" |
ef44eed1 SS |
491 | } |
492 | } | |
493 | ||
494 | # Print scope1.c::bar::funclocal, which is 4 | |
495 | ||
5c6f833b JL |
496 | gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ |
497 | "print bar::funclocal at foo" | |
ef44eed1 | 498 | |
ce102e96 | 499 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
500 | send "print 'scope1.c'::bar::funclocal\n" |
501 | expect { | |
5c6f833b JL |
502 | -re "\\\$$decimal = 4\r\n$prompt $" { |
503 | pass "print 'scope1.c'::bar::funclocal at foo" | |
504 | } | |
ef44eed1 SS |
505 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
506 | send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" | |
507 | exp_continue | |
508 | } | |
5c6f833b | 509 | -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal at foo" } |
ef44eed1 | 510 | timeout { |
5c6f833b | 511 | fail "(timeout) print 'scope1.c'::bar::funclocal at foo" |
ef44eed1 SS |
512 | } |
513 | } | |
ef44eed1 SS |
514 | } |
515 | ||
516 | proc test_at_bar {} { | |
517 | global prompt | |
518 | global decimal | |
519 | global det_file | |
520 | global srcdir | |
521 | global subdir | |
ce102e96 | 522 | global gcc_compiled |
ef44eed1 | 523 | |
ef44eed1 SS |
524 | send "next\n" |
525 | expect { | |
526 | -re ".*$prompt $" {} | |
527 | timeout { fail "next in bar()" ; return } | |
528 | } | |
529 | ||
530 | # Print scope0.c::filelocal, which is 1 | |
531 | ||
ef44eed1 SS |
532 | send "print 'scope0.c'::filelocal\n" |
533 | expect { | |
4081daa1 JK |
534 | -re "\\\$$decimal = 1\r\n$prompt $" { |
535 | pass "print 'scope0.c'::filelocal at bar" | |
536 | } | |
ef44eed1 SS |
537 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
538 | send "print '$srcdir/$subdir/scope0.c'::filelocal\n" | |
539 | exp_continue | |
540 | } | |
4081daa1 | 541 | -re "$prompt $" { fail "print 'scope0.c'::filelocal at bar" ; return } |
ef44eed1 | 542 | timeout { |
4081daa1 | 543 | fail "(timeout) print 'scope0.c'::filelocal at bar" ; return |
ef44eed1 SS |
544 | } |
545 | } | |
546 | ||
547 | # Print scope0.c::filelocal_bss, which is 101 | |
548 | ||
ef44eed1 SS |
549 | send "print 'scope0.c'::filelocal_bss\n" |
550 | expect { | |
6e131ad8 JK |
551 | -re "\\\$$decimal = 101\r\n$prompt $" { |
552 | pass "print 'scope0.c'::filelocal_bss in test_at_bar" | |
553 | } | |
ef44eed1 SS |
554 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
555 | send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" | |
556 | exp_continue | |
557 | } | |
6e131ad8 JK |
558 | -re "$prompt $" { |
559 | fail "print 'scope0.c'::filelocal_bss in test_at_bar" | |
560 | return | |
561 | } | |
ef44eed1 | 562 | timeout { |
6e131ad8 JK |
563 | fail "(timeout) print 'scope0.c'::filelocal_bss in test_at_bar" |
564 | return | |
ef44eed1 SS |
565 | } |
566 | } | |
567 | ||
568 | # Print scope0.c::filelocal_ro, which is 201 | |
569 | ||
ce102e96 | 570 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
5c6f833b | 571 | setup_xfail "powerpc-*-*" |
ef44eed1 SS |
572 | send "print 'scope0.c'::filelocal_ro\n" |
573 | expect { | |
4081daa1 | 574 | -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" } |
ef44eed1 SS |
575 | -re "No symbol \"scope0.c\" in current context.*$prompt $" { |
576 | send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" | |
577 | exp_continue | |
578 | } | |
579 | -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return } | |
580 | timeout { | |
581 | fail "(timeout) print 'scope0.c'::filelocal_ro" ; return | |
582 | } | |
583 | } | |
584 | ||
585 | # Print scope1.c::filelocal, which is 2 | |
586 | ||
587 | send "print filelocal\n" | |
588 | expect { | |
4081daa1 | 589 | -re "\\\$$decimal = 2\r\n$prompt $" { pass "print filelocal" } |
ef44eed1 SS |
590 | -re "$prompt $" { fail "print filelocal" ; return } |
591 | timeout { | |
592 | fail "(timeout) print filelocal" ; return | |
593 | } | |
594 | } | |
595 | ||
ce102e96 | 596 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
597 | send "print 'scope1.c'::filelocal\n" |
598 | expect { | |
4081daa1 | 599 | -re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal" } |
ef44eed1 SS |
600 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
601 | send "print '$srcdir/$subdir/scope1.c'::filelocal\n" | |
602 | exp_continue | |
603 | } | |
604 | -re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return } | |
605 | timeout { | |
606 | fail "(timeout) print 'scope1.c'::filelocal" ; return | |
607 | } | |
608 | } | |
609 | ||
610 | # Print scope1.c::filelocal_bss, which is 102 | |
611 | ||
612 | send "print filelocal_bss\n" | |
613 | expect { | |
4081daa1 | 614 | -re "\\\$$decimal = 102\r\n$prompt $" { pass "print filelocal_bss" } |
ef44eed1 SS |
615 | -re "$prompt $" { fail "print filelocal_bss" ; return } |
616 | timeout { | |
617 | fail "(timeout) print filelocal_bss" ; return | |
618 | } | |
619 | } | |
620 | ||
ce102e96 | 621 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
622 | send "print 'scope1.c'::filelocal_bss\n" |
623 | expect { | |
4081daa1 | 624 | -re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss" } |
ef44eed1 SS |
625 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
626 | send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" | |
627 | exp_continue | |
628 | } | |
629 | -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return } | |
630 | timeout { | |
631 | fail "(timeout) print 'scope1.c'::filelocal_bss" ; return | |
632 | } | |
633 | } | |
634 | ||
635 | # Print scope1.c::filelocal_ro, which is 202 | |
636 | ||
637 | send "print filelocal_ro\n" | |
638 | expect { | |
ce102e96 FF |
639 | -re "\\\$$decimal = 202\r\n$prompt $" { |
640 | pass "print filelocal_ro in test_at_bar" | |
641 | } | |
642 | -re "$prompt $" { | |
643 | fail "print filelocal_ro in test_at_bar" | |
644 | return | |
645 | } | |
ef44eed1 | 646 | timeout { |
ce102e96 FF |
647 | fail "(timeout) print filelocal_ro in test_at_bar" |
648 | return | |
ef44eed1 SS |
649 | } |
650 | } | |
651 | ||
ce102e96 | 652 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
653 | send "print 'scope1.c'::filelocal_ro\n" |
654 | expect { | |
4081daa1 | 655 | -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro" } |
ef44eed1 SS |
656 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
657 | send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" | |
658 | exp_continue | |
659 | } | |
660 | -re "$prompt $" { fail "print 'scope1.c'::filelocal_ro" ; return } | |
661 | timeout { | |
662 | fail "(timeout) print 'scope1.c'::filelocal_ro" ; return | |
663 | } | |
664 | } | |
665 | ||
666 | # Print scope1.c::foo::funclocal, which is 3 | |
667 | ||
ef44eed1 SS |
668 | send "print foo::funclocal\n" |
669 | expect { | |
4081daa1 | 670 | -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" } |
ef44eed1 SS |
671 | -re "$prompt $" { fail "print foo::funclocal" ; return } |
672 | timeout { | |
673 | fail "(timeout) print foo::funclocal" ; return | |
674 | } | |
675 | } | |
676 | ||
ce102e96 | 677 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
678 | send "print 'scope1.c'::foo::funclocal\n" |
679 | expect { | |
4081daa1 | 680 | -re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal" } |
ef44eed1 SS |
681 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
682 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" | |
683 | exp_continue | |
684 | } | |
685 | -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return } | |
686 | timeout { | |
687 | fail "(timeout) print 'scope1.c'::foo::funclocal" ; return | |
688 | } | |
689 | } | |
690 | ||
691 | # Print scope1.c::foo::funclocal_bss, which is 103 | |
692 | ||
693 | send "print foo::funclocal_bss\n" | |
694 | expect { | |
4081daa1 | 695 | -re "\\\$$decimal = 103\r\n$prompt $" { pass "print foo::funclocal_bss" } |
ef44eed1 SS |
696 | -re "$prompt $" { fail "print foo::funclocal_bss" ; return } |
697 | timeout { | |
698 | fail "(timeout) print foo::funclocal_bss" ; return | |
699 | } | |
700 | } | |
701 | ||
ce102e96 | 702 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
703 | send "print 'scope1.c'::foo::funclocal_bss\n" |
704 | expect { | |
4081daa1 | 705 | -re "\\\$$decimal = 103\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_bss" } |
ef44eed1 SS |
706 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
707 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n" | |
708 | exp_continue | |
709 | } | |
710 | -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_bss" ; return } | |
711 | timeout { | |
712 | fail "(timeout) print 'scope1.c'::foo::funclocal_bss" ; return | |
713 | } | |
714 | } | |
715 | ||
716 | # Print scope1.c::foo::funclocal_ro, which is 203 | |
717 | ||
718 | send "print foo::funclocal_ro\n" | |
719 | expect { | |
4081daa1 | 720 | -re "\\\$$decimal = 203\r\n$prompt $" { pass "print foo::funclocal_ro" } |
ef44eed1 SS |
721 | -re "$prompt $" { fail "print foo::funclocal_ro" ; return } |
722 | timeout { | |
723 | fail "(timeout) print foo::funclocal_ro" ; return | |
724 | } | |
725 | } | |
726 | ||
ce102e96 | 727 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
728 | send "print 'scope1.c'::foo::funclocal_ro\n" |
729 | expect { | |
4081daa1 | 730 | -re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro" } |
ef44eed1 SS |
731 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
732 | send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" | |
733 | exp_continue | |
734 | } | |
735 | -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return } | |
736 | timeout { | |
737 | fail "(timeout) print 'scope1.c'::foo::funclocal_ro" ; return | |
738 | } | |
739 | } | |
740 | ||
741 | # Print scope1.c::bar::funclocal, which is 4 | |
742 | ||
743 | send "print funclocal\n" | |
744 | expect { | |
4081daa1 | 745 | -re "\\\$$decimal = 4\r\n$prompt $" { pass "print funclocal" } |
ef44eed1 SS |
746 | -re "$prompt $" { fail "print funclocal" ; return } |
747 | timeout { | |
748 | fail "(timeout) print funclocal" ; return | |
749 | } | |
750 | } | |
751 | ||
752 | send "print bar::funclocal\n" | |
753 | expect { | |
4081daa1 | 754 | -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" } |
ef44eed1 SS |
755 | -re "$prompt $" { fail "print bar::funclocal" ; return } |
756 | timeout { | |
757 | fail "(timeout) print bar::funclocal" ; return | |
758 | } | |
759 | } | |
760 | ||
ce102e96 | 761 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
762 | send "print 'scope1.c'::bar::funclocal\n" |
763 | expect { | |
4081daa1 | 764 | -re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal" } |
ef44eed1 SS |
765 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
766 | send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" | |
767 | exp_continue | |
768 | } | |
769 | -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return } | |
770 | timeout { | |
771 | fail "(timeout) print 'scope1.c'::bar::funclocal" ; return | |
772 | } | |
773 | } | |
774 | ||
775 | # Print scope1.c::bar::funclocal_bss, which is 104 | |
776 | ||
777 | send "print funclocal_bss\n" | |
778 | expect { | |
4081daa1 | 779 | -re "\\\$$decimal = 104\r\n$prompt $" { pass "print funclocal_bss" } |
ef44eed1 SS |
780 | -re "$prompt $" { fail "print funclocal_bss" ; return } |
781 | timeout { | |
782 | fail "(timeout) print funclocal_bss" ; return | |
783 | } | |
784 | } | |
785 | ||
786 | send "print bar::funclocal_bss\n" | |
787 | expect { | |
4081daa1 | 788 | -re "\\\$$decimal = 104\r\n$prompt $" { pass "print bar::funclocal_bss" } |
ef44eed1 SS |
789 | -re "$prompt $" { fail "print bar::funclocal_bss" ; return } |
790 | timeout { | |
791 | fail "(timeout) print bar::funclocal_bss" ; return | |
792 | } | |
793 | } | |
794 | ||
ce102e96 | 795 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
796 | send "print 'scope1.c'::bar::funclocal_bss\n" |
797 | expect { | |
4081daa1 | 798 | -re "\\\$$decimal = 104\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal_bss" } |
ef44eed1 SS |
799 | -re "No symbol \"scope1.c\" in current context.*$prompt $" { |
800 | send "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n" | |
801 | exp_continue | |
802 | } | |
803 | -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal_bss" ; return } | |
804 | timeout { | |
805 | fail "(timeout) print 'scope1.c'::bar::funclocal_bss" ; return | |
806 | } | |
807 | } | |
ef44eed1 SS |
808 | } |
809 | ||
5c6f833b JL |
810 | # This test has little to do with local scopes, but it is in scope.exp anyway. |
811 | # That's life. | |
ef44eed1 SS |
812 | |
813 | proc test_at_autovars {} { | |
814 | global prompt | |
815 | global decimal | |
816 | global hex | |
817 | global srcfile | |
818 | ||
819 | # Test symbol table lookup with 100 local (auto) variables. | |
820 | ||
821 | send "break marker1\n" ; expect -re ".*$prompt $" | |
822 | ||
823 | send "cont\n" | |
824 | expect { | |
6e131ad8 | 825 | -re "Break.* marker1 \\(\\) at .*:$decimal.*$prompt $" { |
ef44eed1 SS |
826 | send "up\n" |
827 | expect { | |
828 | -re ".*$prompt $" {} | |
829 | timeout { fail "up from marker1" ; return } | |
830 | } | |
831 | } | |
832 | -re "$prompt $" { fail "continue to marker1" ; return } | |
833 | timeout { fail "(timeout) continue to marker1" ; return } | |
834 | } | |
835 | ||
836 | set count 0 | |
837 | while {$count < 100} { | |
838 | send "print i$count\n" | |
839 | expect { | |
840 | -re ".* = $count\r\n$prompt $" {} | |
841 | -re "$prompt $" { | |
842 | fail "bad value for auto variable i$count"; return | |
843 | } | |
844 | timeout { | |
845 | fail "(timeout) bad value for auto variable i$count"; return | |
846 | } | |
847 | } | |
848 | set count [expr $count+1] | |
849 | } | |
850 | clear_xfail "*-*-*" | |
851 | pass "$count auto variables correctly initialized" | |
852 | ||
853 | # Test that block variable sorting is not screwing us. | |
4081daa1 | 854 | gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order" |
ef44eed1 SS |
855 | } |
856 | ||
857 | proc test_at_localscopes {} { | |
858 | global prompt | |
859 | global decimal | |
860 | global hex | |
861 | global srcfile | |
862 | ||
ef44eed1 SS |
863 | send "break marker2\n" ; expect -re ".*$prompt $" |
864 | send "break marker3\n" ; expect -re ".*$prompt $" | |
865 | send "break marker4\n" ; expect -re ".*$prompt $" | |
866 | ||
867 | send "cont\n" | |
868 | expect { | |
6e131ad8 | 869 | -re "Break.* marker2 \\(\\) at .*:$decimal.*$prompt $" { |
ef44eed1 SS |
870 | send "up\n" |
871 | expect { | |
872 | -re ".*$prompt $" {} | |
873 | timeout { fail "up from marker2" ; return } | |
874 | } | |
875 | } | |
876 | -re "$prompt $" { fail "continue to marker2" ; return } | |
877 | timeout { fail "(timeout) continue to marker2" ; return } | |
878 | } | |
879 | ||
880 | # Should be at first (outermost) scope. Check values. | |
881 | ||
5c6f833b JL |
882 | gdb_test "print localval" " = 10" "print localval, outer scope" |
883 | gdb_test "print localval1" " = 11" "print localval1, outer scope" | |
884 | gdb_test "print localval2" "No symbol \"localval2\" in current context." \ | |
885 | "print localval2, outer scope" | |
886 | gdb_test "print localval3" "No symbol \"localval3\" in current context." \ | |
887 | "print localval3, outer scope" | |
ef44eed1 | 888 | |
5c6f833b JL |
889 | if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \ |
890 | "continue to marker3 in scope.exp"] then { return } | |
891 | if [gdb_test "up" "" "up from marker3 in scope.exp"] then { return } | |
ef44eed1 SS |
892 | |
893 | # Should be at next (first nested) scope. Check values. | |
894 | ||
5c6f833b JL |
895 | gdb_test "print localval" " = 20" \ |
896 | "print localval, first nested scope" | |
897 | gdb_test "print localval1" " = 11" "print localval1, first nested scope" | |
898 | gdb_test "print localval2" " = 12" "print localval2, first nested scope" | |
899 | gdb_test "print localval3" "No symbol \"localval3\" in current context." \ | |
900 | "print localval3, first nested scope" | |
ef44eed1 SS |
901 | |
902 | # This test will only fail if the file was compiled by gcc, but | |
903 | # there's no way to check that. | |
ef44eed1 | 904 | setup_xfail "a29k-*-udi" 2423 |
5c6f833b JL |
905 | if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \ |
906 | "continue to marker4 in scope.exp"] then { return } | |
907 | if [gdb_test "up" "" "up from marker4 in scope.exp"] then { return } | |
908 | ||
909 | gdb_test "print localval" " = 30" "print localval, innermost scope" | |
910 | gdb_test "print localval1" " = 11" "print localval1, innermost scope" | |
911 | gdb_test "print localval2" " = 12" "print localval2, innermost scope" | |
912 | gdb_test "print localval3" " = 13" "print localval3, innermost scope" | |
ef44eed1 SS |
913 | } |
914 | ||
915 | # Start with a fresh gdb. | |
916 | ||
917 | gdb_exit | |
918 | gdb_start | |
919 | gdb_reinitialize_dir $srcdir/$subdir | |
920 | gdb_load $objdir/$subdir/$binfile | |
921 | ||
e965bc39 | 922 | if [istarget "*-*-vxworks*"] { |
ef44eed1 SS |
923 | set timeout 120 |
924 | } | |
925 | ||
926 | # Test that variables in various segments print out correctly before | |
927 | # the program is run. | |
928 | ||
929 | # AIX--sections get mapped to the same address so we can't get the right one. | |
930 | setup_xfail "rs6000-*-*" | |
5c6f833b | 931 | setup_xfail "powerpc-*-*" |
ef44eed1 SS |
932 | |
933 | gdb_test "print 'scope0.c'::filelocal_ro" "= 201" | |
934 | ||
935 | # gdb currently cannot access bss memory on some targets if the inferior | |
936 | # is not running. | |
b9ba33e6 JL |
937 | # |
938 | # For PA boards using monitor/remote-pa.c, the bss test is going to | |
939 | # randomly fail. We've already put remote-pa on the target stack, | |
940 | # so we actually read memory from the board. Problem is crt0.o | |
941 | # is responsible for clearing bss and that hasnt' happened yet. | |
942 | setup_xfail "hppa*-*-*pro*" | |
ce102e96 | 943 | if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } |
ef44eed1 SS |
944 | send "print 'scope0.c'::filelocal_bss\n" |
945 | expect { | |
6e131ad8 JK |
946 | -re " = 0\r\n$prompt $" { |
947 | pass "print 'scope0.c'::filelocal_bss before run" | |
ef44eed1 SS |
948 | } |
949 | -re "Cannot access memory.*$prompt $" { | |
950 | setup_xfail "*-*-*" | |
6e131ad8 | 951 | fail "print 'scope0.c'::filelocal_bss before run" |
ef44eed1 SS |
952 | } |
953 | -re ".*$prompt $" { | |
6e131ad8 | 954 | fail "print 'scope0.c'::filelocal_bss before run" |
ef44eed1 SS |
955 | } |
956 | default { | |
6e131ad8 | 957 | fail "print 'scope0.c'::filelocal_bss before run" |
ef44eed1 SS |
958 | } |
959 | } | |
960 | ||
961 | # AIX--sections get mapped to the same address so we can't get the right one. | |
962 | setup_xfail "rs6000-*-*" | |
963 | ||
4081daa1 JK |
964 | gdb_test "print 'scope0.c'::filelocal" "= 1" \ |
965 | "print 'scope0.c'::filelocal before run" | |
ef44eed1 | 966 | |
5c6f833b | 967 | if [runto_main] then { test_at_main } |
ef44eed1 SS |
968 | if [istarget "mips-idt-*"] then { |
969 | # Restart because IDT/SIM runs out of file descriptors. | |
970 | gdb_exit | |
971 | gdb_start | |
972 | gdb_reinitialize_dir $srcdir/$subdir | |
973 | gdb_load $objdir/$subdir/$binfile | |
974 | } | |
ef44eed1 SS |
975 | if [runto foo] then { test_at_foo } |
976 | if [istarget "mips-idt-*"] then { | |
977 | # Restart because IDT/SIM runs out of file descriptors. | |
978 | gdb_exit | |
979 | gdb_start | |
980 | gdb_reinitialize_dir $srcdir/$subdir | |
981 | gdb_load $objdir/$subdir/$binfile | |
982 | } | |
ef44eed1 SS |
983 | if [runto bar] then { test_at_bar } |
984 | if [istarget "mips-idt-*"] then { | |
985 | # Restart because IDT/SIM runs out of file descriptors. | |
986 | gdb_exit | |
987 | gdb_start | |
988 | gdb_reinitialize_dir $srcdir/$subdir | |
989 | gdb_load $objdir/$subdir/$binfile | |
990 | } | |
ef44eed1 SS |
991 | if [runto localscopes] then { test_at_localscopes } |
992 | if [istarget "mips-idt-*"] then { | |
993 | # Restart because IDT/SIM runs out of file descriptors. | |
994 | gdb_exit | |
995 | gdb_start | |
996 | gdb_reinitialize_dir $srcdir/$subdir | |
997 | gdb_load $objdir/$subdir/$binfile | |
998 | } | |
ef44eed1 SS |
999 | if [runto autovars] then { test_at_autovars } |
1000 | ||
e965bc39 | 1001 | if [istarget "*-*-vxworks*"] { |
ef44eed1 SS |
1002 | set timeout 120 |
1003 | } |