1 |
1181 |
sfurman |
# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
|
2 |
|
|
# Free Software Foundation, Inc.
|
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
|
6 |
|
|
# the Free Software Foundation; either version 2 of the License, or
|
7 |
|
|
# (at your option) any later version.
|
8 |
|
|
#
|
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.
|
13 |
|
|
#
|
14 |
|
|
# You should have received a copy of the GNU General Public License
|
15 |
|
|
# along with this program; if not, write to the Free Software
|
16 |
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
17 |
|
|
|
18 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
19 |
|
|
# bug-gdb@prep.ai.mit.edu
|
20 |
|
|
|
21 |
|
|
# This file was written by Fred Fish. (fnf@cygnus.com)
|
22 |
|
|
|
23 |
|
|
if $tracelevel {
|
24 |
|
|
strace $tracelevel
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
set prms_id 0
|
28 |
|
|
set bug_id 0
|
29 |
|
|
|
30 |
|
|
set testfile "funcargs"
|
31 |
|
|
set srcfile ${testfile}.c
|
32 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
33 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
34 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
# Create and source the file that provides information about the compiler
|
38 |
|
|
# used to compile the test case.
|
39 |
|
|
if [get_compiler_info ${binfile}] {
|
40 |
|
|
return -1;
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
#
|
44 |
|
|
# Locate actual args; integral types.
|
45 |
|
|
#
|
46 |
|
|
|
47 |
|
|
proc integral_args {} {
|
48 |
|
|
global gdb_prompt
|
49 |
|
|
global det_file
|
50 |
|
|
global gcc_compiled
|
51 |
|
|
|
52 |
|
|
delete_breakpoints
|
53 |
|
|
|
54 |
|
|
gdb_breakpoint call0a
|
55 |
|
|
gdb_breakpoint call0b
|
56 |
|
|
gdb_breakpoint call0c
|
57 |
|
|
gdb_breakpoint call0d
|
58 |
|
|
gdb_breakpoint call0e
|
59 |
|
|
|
60 |
|
|
# Run; should stop at call0a and print actual arguments.
|
61 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
62 |
|
|
gdb_run_cmd
|
63 |
|
|
gdb_expect {
|
64 |
|
|
-re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
|
65 |
|
|
pass "run to call0a"
|
66 |
|
|
}
|
67 |
|
|
-re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
|
68 |
|
|
timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
# Print each arg as a double check to see if we can print
|
72 |
|
|
# them here as well as with backtrace.
|
73 |
|
|
gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
|
74 |
|
|
gdb_test "print s" ".* = 1" "print s after run to call0a"
|
75 |
|
|
gdb_test "print i" ".* = 2" "print i after run to call0a"
|
76 |
|
|
gdb_test "print l " ".* = 3" "print l after run to call0a"
|
77 |
|
|
|
78 |
|
|
# Continue; should stop at call0b and print actual arguments.
|
79 |
|
|
if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
|
80 |
|
|
gdb_suppress_tests;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
# Continue; should stop at call0c and print actual arguments.
|
84 |
|
|
if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
|
85 |
|
|
gdb_suppress_tests;
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
# Continue; should stop at call0d and print actual arguments.
|
89 |
|
|
if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
|
90 |
|
|
gdb_suppress_tests;
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
# Continue; should stop at call0e and print actual arguments.
|
94 |
|
|
if [gdb_test "cont" ".* call0e \\(c1=97 'a', l=3, c2=97 'a', i=2, c3=97 'a', s=1, c4=97 'a', c5=97 'a'\\) .*" "continue to call0e" ] {
|
95 |
|
|
gdb_suppress_tests;
|
96 |
|
|
}
|
97 |
|
|
gdb_stop_suppressing_tests;
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
#
|
101 |
|
|
# Locate actual args; unsigned integral types.
|
102 |
|
|
#
|
103 |
|
|
|
104 |
|
|
proc unsigned_integral_args {} {
|
105 |
|
|
global gdb_prompt
|
106 |
|
|
global det_file
|
107 |
|
|
global gcc_compiled
|
108 |
|
|
|
109 |
|
|
delete_breakpoints
|
110 |
|
|
|
111 |
|
|
gdb_breakpoint call1a;
|
112 |
|
|
gdb_breakpoint call1b;
|
113 |
|
|
gdb_breakpoint call1c;
|
114 |
|
|
gdb_breakpoint call1d;
|
115 |
|
|
gdb_breakpoint call1e;
|
116 |
|
|
|
117 |
|
|
# Run; should stop at call1a and print actual arguments.
|
118 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
119 |
|
|
gdb_run_cmd
|
120 |
|
|
gdb_expect {
|
121 |
|
|
-re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
|
122 |
|
|
pass "run to call1a"
|
123 |
|
|
}
|
124 |
|
|
-re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
|
125 |
|
|
timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
# Print each arg as a double check to see if we can print
|
129 |
|
|
# them here as well as with backtrace.
|
130 |
|
|
gdb_test "print uc" ".* = 98 'b'"
|
131 |
|
|
gdb_test "print us" ".* = 6"
|
132 |
|
|
gdb_test "print ui" ".* = 7"
|
133 |
|
|
gdb_test "print ul" ".* = 8"
|
134 |
|
|
|
135 |
|
|
# Continue; should stop at call1b and print actual arguments.
|
136 |
|
|
if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
|
137 |
|
|
gdb_suppress_tests;
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
# Continue; should stop at call1c and print actual arguments.
|
141 |
|
|
if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
|
142 |
|
|
gdb_suppress_tests;
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
# Continue; should stop at call1d and print actual arguments.
|
146 |
|
|
if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
|
147 |
|
|
gdb_suppress_tests;
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
# Continue; should stop at call1e and print actual arguments.
|
151 |
|
|
if [gdb_test "cont" ".* call1e \\(uc1=98 'b', ul=8, uc2=98 'b', ui=7, uc3=98 'b', us=6, uc4=98 'b', uc5=98 'b'\\) .*" "continue to call1e"] {
|
152 |
|
|
gdb_suppress_tests;
|
153 |
|
|
}
|
154 |
|
|
gdb_stop_suppressing_tests;
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
#
|
158 |
|
|
# Locate actual args; integrals mixed with floating point.
|
159 |
|
|
#
|
160 |
|
|
|
161 |
|
|
proc float_and_integral_args {} {
|
162 |
|
|
global gdb_prompt
|
163 |
|
|
global det_file
|
164 |
|
|
global gcc_compiled
|
165 |
|
|
global hp_cc_compiler
|
166 |
|
|
|
167 |
|
|
delete_breakpoints
|
168 |
|
|
|
169 |
|
|
gdb_breakpoint call2a
|
170 |
|
|
gdb_breakpoint call2b
|
171 |
|
|
gdb_breakpoint call2c
|
172 |
|
|
gdb_breakpoint call2d
|
173 |
|
|
gdb_breakpoint call2e
|
174 |
|
|
gdb_breakpoint call2f
|
175 |
|
|
gdb_breakpoint call2g
|
176 |
|
|
gdb_breakpoint call2h
|
177 |
|
|
|
178 |
|
|
# Run; should stop at call2a and print actual arguments.
|
179 |
|
|
|
180 |
|
|
setup_xfail "i960-*-*" 1813
|
181 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
|
182 |
|
|
# The debug info. for "f" is not correct. It's a known bug.
|
183 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
184 |
|
|
gdb_run_cmd
|
185 |
|
|
gdb_expect {
|
186 |
|
|
-re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" }
|
187 |
|
|
-re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
|
188 |
|
|
-re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
|
189 |
|
|
timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
# Print each arg as a double check to see if we can print
|
193 |
|
|
gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
|
194 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
195 |
|
|
gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
|
196 |
|
|
gdb_test "print s" ".* = 1" "print s after run to call2a"
|
197 |
|
|
gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
|
198 |
|
|
gdb_test "print i" ".* = 2" "print i after run to call2a"
|
199 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
200 |
|
|
gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
|
201 |
|
|
gdb_test "print l" ".* = 3" "print l after run to call2a"
|
202 |
|
|
gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
|
203 |
|
|
|
204 |
|
|
setup_xfail "rs6000-*-*"
|
205 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
206 |
|
|
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
|
207 |
|
|
# Continue; should stop at call2b and print actual arguments.
|
208 |
|
|
if [gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"] {
|
209 |
|
|
gdb_suppress_tests;
|
210 |
|
|
}
|
211 |
|
|
|
212 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
213 |
|
|
# Continue; should stop at call2c and print actual arguments.
|
214 |
|
|
if [gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"] {
|
215 |
|
|
gdb_suppress_tests;
|
216 |
|
|
}
|
217 |
|
|
|
218 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
219 |
|
|
# Continue; should stop at call2d and print actual arguments.
|
220 |
|
|
if [gdb_test "cont" ".* call2d \\(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\\) .*" "continue to call2d"] {
|
221 |
|
|
gdb_suppress_tests;
|
222 |
|
|
}
|
223 |
|
|
|
224 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
225 |
|
|
# Continue; should stop at call2e and print actual arguments.
|
226 |
|
|
if [gdb_test "cont" ".* call2e \\(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\\) .*" "continue to call2e"] {
|
227 |
|
|
gdb_suppress_tests;
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
231 |
|
|
# Continue; should stop at call2f and print actual arguments.
|
232 |
|
|
if [gdb_test "cont" ".* call2f \\(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\\) .*" "continue to call2f"] {
|
233 |
|
|
gdb_suppress_tests;
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
237 |
|
|
# Continue; should stop at call2g and print actual arguments.
|
238 |
|
|
if [gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"] {
|
239 |
|
|
gdb_suppress_tests;
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
243 |
|
|
# Continue; should stop at call2h and print actual arguments.
|
244 |
|
|
if [gdb_test "cont" ".* call2h \\(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\\) .*" "continue to call2h"] {
|
245 |
|
|
gdb_suppress_tests;
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
# monitor only allows 8 breakpoints; w89k board allows 10, so
|
249 |
|
|
# break them up into two groups.
|
250 |
|
|
delete_breakpoints
|
251 |
|
|
gdb_breakpoint call2i
|
252 |
|
|
|
253 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
254 |
|
|
# Continue; should stop at call2i and print actual arguments.
|
255 |
|
|
if [gdb_test "cont" ".* call2i \\(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\\) .*" "continue to call2i"] {
|
256 |
|
|
gdb_suppress_tests;
|
257 |
|
|
}
|
258 |
|
|
gdb_stop_suppressing_tests;
|
259 |
|
|
}
|
260 |
|
|
|
261 |
|
|
#
|
262 |
|
|
# Locate actual args; dereference pointers to ints and floats.
|
263 |
|
|
#
|
264 |
|
|
|
265 |
|
|
proc pointer_args {} {
|
266 |
|
|
global gdb_prompt
|
267 |
|
|
global hex
|
268 |
|
|
global det_file
|
269 |
|
|
|
270 |
|
|
delete_breakpoints
|
271 |
|
|
|
272 |
|
|
gdb_breakpoint call3a
|
273 |
|
|
gdb_breakpoint call3b
|
274 |
|
|
gdb_breakpoint call3c
|
275 |
|
|
|
276 |
|
|
# Run; should stop at call3a and print actual arguments.
|
277 |
|
|
# Try dereferencing the arguments.
|
278 |
|
|
|
279 |
|
|
gdb_run_cmd
|
280 |
|
|
gdb_expect {
|
281 |
|
|
-re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
|
282 |
|
|
-re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
|
283 |
|
|
timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
|
284 |
|
|
}
|
285 |
|
|
|
286 |
|
|
gdb_test "print *cp" ".* = 97 'a'"
|
287 |
|
|
gdb_test "print *sp" ".* = 1"
|
288 |
|
|
gdb_test "print *ip" ".* = 2"
|
289 |
|
|
gdb_test "print *lp" ".* = 3"
|
290 |
|
|
|
291 |
|
|
# Continue; should stop at call3b and print actual arguments.
|
292 |
|
|
# Try dereferencing the arguments.
|
293 |
|
|
if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
|
294 |
|
|
gdb_suppress_tests;
|
295 |
|
|
}
|
296 |
|
|
|
297 |
|
|
gdb_test "print *ucp" ".* = 98 'b'"
|
298 |
|
|
gdb_test "print *usp" ".* = 6"
|
299 |
|
|
gdb_test "print *uip" ".* = 7"
|
300 |
|
|
gdb_test "print *ulp" ".* = 8"
|
301 |
|
|
|
302 |
|
|
# Continue; should stop at call3c and print actual arguments.
|
303 |
|
|
# Try dereferencing the arguments.
|
304 |
|
|
if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
|
305 |
|
|
gdb_suppress_tests;
|
306 |
|
|
}
|
307 |
|
|
|
308 |
|
|
gdb_test "print *fp" ".* = 4"
|
309 |
|
|
gdb_test "print *dp" ".* = 5"
|
310 |
|
|
|
311 |
|
|
# pass "locate actual args, pointer types"
|
312 |
|
|
gdb_stop_suppressing_tests;
|
313 |
|
|
}
|
314 |
|
|
|
315 |
|
|
#
|
316 |
|
|
# Locate actual args; structures and unions passed by reference.
|
317 |
|
|
#
|
318 |
|
|
|
319 |
|
|
proc structs_by_reference {} {
|
320 |
|
|
global gdb_prompt
|
321 |
|
|
global hex
|
322 |
|
|
global det_file
|
323 |
|
|
global target_sizeof_int
|
324 |
|
|
global target_sizeof_long
|
325 |
|
|
global target_bigendian_p
|
326 |
|
|
|
327 |
|
|
delete_breakpoints
|
328 |
|
|
|
329 |
|
|
gdb_breakpoint call4a
|
330 |
|
|
gdb_breakpoint call4b
|
331 |
|
|
|
332 |
|
|
# Run; should stop at call4a and print actual arguments.
|
333 |
|
|
# Try dereferencing the arguments.
|
334 |
|
|
|
335 |
|
|
gdb_run_cmd
|
336 |
|
|
gdb_expect {
|
337 |
|
|
-re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
|
338 |
|
|
pass "run to call4a"
|
339 |
|
|
}
|
340 |
|
|
-re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
|
341 |
|
|
timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
|
342 |
|
|
}
|
343 |
|
|
|
344 |
|
|
gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
|
345 |
|
|
|
346 |
|
|
# Continue; should stop at call4b and print actual arguments.
|
347 |
|
|
|
348 |
|
|
gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
|
349 |
|
|
|
350 |
|
|
# Try dereferencing the arguments.
|
351 |
|
|
if { $target_sizeof_long == $target_sizeof_int } {
|
352 |
|
|
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
|
353 |
|
|
"print *unp (sizeof long == sizeof int)"
|
354 |
|
|
} elseif { ! $target_bigendian_p } {
|
355 |
|
|
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
|
356 |
|
|
"print *unp (little-endian, sizeof long != sizeof int)"
|
357 |
|
|
} elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
|
358 |
|
|
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
|
359 |
|
|
"print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
|
360 |
|
|
} elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
|
361 |
|
|
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
|
362 |
|
|
"print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
|
363 |
|
|
} else {
|
364 |
|
|
fail "print *unp (unknown case)"
|
365 |
|
|
}
|
366 |
|
|
|
367 |
|
|
pass "locate actual args, structs/unions passed by reference"
|
368 |
|
|
gdb_stop_suppressing_tests;
|
369 |
|
|
}
|
370 |
|
|
|
371 |
|
|
#
|
372 |
|
|
# Locate actual args; structures and unions passed by value.
|
373 |
|
|
#
|
374 |
|
|
|
375 |
|
|
proc structs_by_value {} {
|
376 |
|
|
global gdb_prompt
|
377 |
|
|
global hex
|
378 |
|
|
global det_file
|
379 |
|
|
global target_sizeof_int
|
380 |
|
|
global target_sizeof_long
|
381 |
|
|
global target_bigendian_p
|
382 |
|
|
|
383 |
|
|
delete_breakpoints
|
384 |
|
|
|
385 |
|
|
gdb_breakpoint call5a
|
386 |
|
|
gdb_breakpoint call5b
|
387 |
|
|
|
388 |
|
|
# Run; should stop at call5a and print actual arguments.
|
389 |
|
|
# Try dereferencing the arguments.
|
390 |
|
|
|
391 |
|
|
gdb_run_cmd
|
392 |
|
|
gdb_expect {
|
393 |
|
|
-re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
|
394 |
|
|
pass "run to call5a"
|
395 |
|
|
}
|
396 |
|
|
-re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
|
397 |
|
|
timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
|
398 |
|
|
}
|
399 |
|
|
|
400 |
|
|
gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
|
401 |
|
|
|
402 |
|
|
# Continue; should stop at call5b and print actual arguments.
|
403 |
|
|
if { $target_sizeof_long == $target_sizeof_int } {
|
404 |
|
|
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
|
405 |
|
|
"continue to call5b (sizeof long == sizeof int)"
|
406 |
|
|
} elseif { ! $target_bigendian_p } {
|
407 |
|
|
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
|
408 |
|
|
"continue to call5b (little-endian, sizeof long != sizeof int)"
|
409 |
|
|
} elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
|
410 |
|
|
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
|
411 |
|
|
"continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
|
412 |
|
|
} elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
|
413 |
|
|
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
|
414 |
|
|
"continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
|
415 |
|
|
} else {
|
416 |
|
|
fail "continue to call5b (unknown case)"
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
# Try dereferencing the arguments.
|
420 |
|
|
if { $target_sizeof_long == $target_sizeof_int } {
|
421 |
|
|
gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
|
422 |
|
|
"print un (sizeof long == sizeof int)"
|
423 |
|
|
} elseif { ! $target_bigendian_p } {
|
424 |
|
|
gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
|
425 |
|
|
"print un (little-endian, sizeof long != sizeof int)"
|
426 |
|
|
} elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
|
427 |
|
|
gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
|
428 |
|
|
"print un (big-endian, sizeof long == 8, sizeof int = 4)"
|
429 |
|
|
} elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
|
430 |
|
|
gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
|
431 |
|
|
"print un (big-endian, sizeof long == 4, sizeof int = 2)"
|
432 |
|
|
} else {
|
433 |
|
|
fail "print un (unknown case)"
|
434 |
|
|
}
|
435 |
|
|
|
436 |
|
|
gdb_stop_suppressing_tests;
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
#
|
440 |
|
|
# Locate actual args; discard, shuffle, and call
|
441 |
|
|
#
|
442 |
|
|
|
443 |
|
|
proc discard_and_shuffle {} {
|
444 |
|
|
global gdb_prompt
|
445 |
|
|
global hex
|
446 |
|
|
global decimal
|
447 |
|
|
global det_file
|
448 |
|
|
global gcc_compiled
|
449 |
|
|
global hp_cc_compiler
|
450 |
|
|
|
451 |
|
|
delete_breakpoints
|
452 |
|
|
|
453 |
|
|
gdb_breakpoint call6a
|
454 |
|
|
gdb_breakpoint call6b
|
455 |
|
|
gdb_breakpoint call6c
|
456 |
|
|
gdb_breakpoint call6d
|
457 |
|
|
gdb_breakpoint call6e
|
458 |
|
|
gdb_breakpoint call6f
|
459 |
|
|
gdb_breakpoint call6g
|
460 |
|
|
gdb_breakpoint call6h
|
461 |
|
|
|
462 |
|
|
# Run; should stop at call6a and print actual arguments.
|
463 |
|
|
# Print backtrace.
|
464 |
|
|
|
465 |
|
|
gdb_run_cmd
|
466 |
|
|
gdb_expect {
|
467 |
|
|
-re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
|
468 |
|
|
-re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
|
469 |
|
|
timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
|
470 |
|
|
}
|
471 |
|
|
|
472 |
|
|
setup_xfail "rs6000-*-*"
|
473 |
|
|
|
474 |
|
|
if {!$gcc_compiled} {
|
475 |
|
|
setup_xfail "mips-sgi-irix5*"
|
476 |
|
|
}
|
477 |
|
|
|
478 |
|
|
# The debug info. for "f" is not correct. It's a known bug.
|
479 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
480 |
|
|
send_gdb "backtrace 100\n"
|
481 |
|
|
gdb_expect {
|
482 |
|
|
-re "backtrace 100\[\r\n\]+
|
483 |
|
|
.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
|
484 |
|
|
.* main \\(.*\\) .*\r
|
485 |
|
|
$gdb_prompt $" {
|
486 |
|
|
pass "backtrace from call6a"
|
487 |
|
|
}
|
488 |
|
|
-re "backtrace 100\[\r\n\]+
|
489 |
|
|
.* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
|
490 |
|
|
.* main \\(.*\\) .*\r
|
491 |
|
|
$gdb_prompt $" {
|
492 |
|
|
xfail "backtrace from call6a"
|
493 |
|
|
}
|
494 |
|
|
-re "$gdb_prompt $" {
|
495 |
|
|
fail "backtrace from call6a"
|
496 |
|
|
gdb_suppress_tests
|
497 |
|
|
}
|
498 |
|
|
timeout {
|
499 |
|
|
fail "(timeout) backtrace from call6a"
|
500 |
|
|
gdb_suppress_tests
|
501 |
|
|
}
|
502 |
|
|
}
|
503 |
|
|
|
504 |
|
|
# Continue; should stop at call6b and print actual arguments.
|
505 |
|
|
# Print backtrace.
|
506 |
|
|
|
507 |
|
|
gdb_continue call6b
|
508 |
|
|
|
509 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
510 |
|
|
send_gdb "backtrace 100\n"
|
511 |
|
|
if [gdb_expect_list "backtrace from call6b" ".*$gdb_prompt $" {
|
512 |
|
|
".*\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
513 |
|
|
".*\[\r\n\]#1 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
514 |
|
|
".*\[\r\n\]#2 .* main \\(.*\\) "
|
515 |
|
|
} ] {
|
516 |
|
|
gdb_suppress_tests;
|
517 |
|
|
}
|
518 |
|
|
|
519 |
|
|
# Continue; should stop at call6c and print actual arguments.
|
520 |
|
|
# Print backtrace.
|
521 |
|
|
|
522 |
|
|
gdb_continue call6c
|
523 |
|
|
|
524 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
525 |
|
|
send_gdb "backtrace 100\n"
|
526 |
|
|
if [gdb_expect_list "backtrace from call6c" ".*$gdb_prompt $" {
|
527 |
|
|
".*\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
528 |
|
|
".*\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
529 |
|
|
".*\[\r\n\]#2 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
530 |
|
|
".*\[\r\n\]#3 .* main \\(.*\\) "
|
531 |
|
|
} ] {
|
532 |
|
|
gdb_suppress_tests;
|
533 |
|
|
}
|
534 |
|
|
# Continue; should stop at call6d and print actual arguments.
|
535 |
|
|
# Print backtrace.
|
536 |
|
|
|
537 |
|
|
gdb_continue call6d
|
538 |
|
|
|
539 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
540 |
|
|
send_gdb "backtrace 100\n"
|
541 |
|
|
if [gdb_expect_list "backtrace from call6d" ".*$gdb_prompt $" {
|
542 |
|
|
".*\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
543 |
|
|
".*\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
544 |
|
|
".*\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
545 |
|
|
".*\[\r\n\]#3 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
546 |
|
|
".*\[\r\n\]#4 .* main \\(.*\\) "
|
547 |
|
|
} ] {
|
548 |
|
|
gdb_suppress_tests;
|
549 |
|
|
}
|
550 |
|
|
|
551 |
|
|
# Continue; should stop at call6e and print actual arguments.
|
552 |
|
|
# Print backtrace.
|
553 |
|
|
|
554 |
|
|
gdb_continue call6e
|
555 |
|
|
|
556 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
557 |
|
|
send_gdb "backtrace 100\n"
|
558 |
|
|
if [gdb_expect_list "backtrace from call6e" ".*$gdb_prompt $" {
|
559 |
|
|
".*\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
560 |
|
|
".*\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
561 |
|
|
".*\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
562 |
|
|
".*\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
563 |
|
|
".*\[\r\n\]#4 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
564 |
|
|
".*\[\r\n\]#5 .* main \\(.*\\) "
|
565 |
|
|
} ] {
|
566 |
|
|
gdb_suppress_tests;
|
567 |
|
|
}
|
568 |
|
|
|
569 |
|
|
# Continue; should stop at call6f and print actual arguments.
|
570 |
|
|
# Print backtrace.
|
571 |
|
|
|
572 |
|
|
gdb_continue call6f
|
573 |
|
|
|
574 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
575 |
|
|
send_gdb "backtrace 100\n"
|
576 |
|
|
if [gdb_expect_list "backtrace from call6f" ".*$gdb_prompt $" {
|
577 |
|
|
".*\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
578 |
|
|
".*\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
579 |
|
|
".*\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
580 |
|
|
".*\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
581 |
|
|
".*\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
582 |
|
|
".*\[\r\n\]#5 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
583 |
|
|
".*\[\r\n\]#6 .* main \\(.*\\) "
|
584 |
|
|
} ] {
|
585 |
|
|
gdb_suppress_tests;
|
586 |
|
|
}
|
587 |
|
|
|
588 |
|
|
# Continue; should stop at call6g and print actual arguments.
|
589 |
|
|
# Print backtrace.
|
590 |
|
|
|
591 |
|
|
gdb_continue call6g
|
592 |
|
|
|
593 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
594 |
|
|
send_gdb "backtrace 100\n"
|
595 |
|
|
if [gdb_expect_list "backtrace from call6g" ".*$gdb_prompt $" {
|
596 |
|
|
".*\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
|
597 |
|
|
".*\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
598 |
|
|
".*\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
599 |
|
|
".*\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
600 |
|
|
".*\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
601 |
|
|
".*\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
602 |
|
|
".*\[\r\n\]#6 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
603 |
|
|
".*\[\r\n\]#7 .* main \\(.*\\) "
|
604 |
|
|
} ] {
|
605 |
|
|
gdb_suppress_tests;
|
606 |
|
|
}
|
607 |
|
|
|
608 |
|
|
# Continue; should stop at call6h and print actual arguments.
|
609 |
|
|
# Print backtrace.
|
610 |
|
|
|
611 |
|
|
gdb_continue call6h
|
612 |
|
|
|
613 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
614 |
|
|
send_gdb "backtrace 100\n"
|
615 |
|
|
if [gdb_expect_list "backtrace from call6h" ".*$gdb_prompt $" {
|
616 |
|
|
".*\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
|
617 |
|
|
".*\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
|
618 |
|
|
".*\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
619 |
|
|
".*\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
620 |
|
|
".*\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
621 |
|
|
".*\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
622 |
|
|
".*\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
623 |
|
|
".*\[\r\n\]#7 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
624 |
|
|
".*\[\r\n\]#8 .* main \\(.*\\) "
|
625 |
|
|
} ] {
|
626 |
|
|
gdb_suppress_tests;
|
627 |
|
|
}
|
628 |
|
|
|
629 |
|
|
# monitor only allows 8 breakpoints; w89k board allows 10, so
|
630 |
|
|
# break them up into two groups.
|
631 |
|
|
delete_breakpoints
|
632 |
|
|
gdb_breakpoint call6i
|
633 |
|
|
gdb_breakpoint call6j
|
634 |
|
|
gdb_breakpoint call6k
|
635 |
|
|
|
636 |
|
|
# Continue; should stop at call6i and print actual arguments.
|
637 |
|
|
# Print backtrace.
|
638 |
|
|
|
639 |
|
|
gdb_continue call6i
|
640 |
|
|
|
641 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
642 |
|
|
send_gdb "backtrace 100\n"
|
643 |
|
|
if [gdb_expect_list "backtrace from call6i" ".*$gdb_prompt $" {
|
644 |
|
|
".*\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
|
645 |
|
|
".*\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
|
646 |
|
|
".*\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
|
647 |
|
|
".*\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
648 |
|
|
".*\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
649 |
|
|
".*\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
650 |
|
|
".*\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
651 |
|
|
".*\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
652 |
|
|
".*\[\r\n\]#8 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
653 |
|
|
".*\[\r\n\]#9 .* main \\(.*\\) "
|
654 |
|
|
} ] {
|
655 |
|
|
gdb_suppress_tests;
|
656 |
|
|
}
|
657 |
|
|
|
658 |
|
|
# Continue; should stop at call6j and print actual arguments.
|
659 |
|
|
# Print backtrace.
|
660 |
|
|
|
661 |
|
|
gdb_continue call6j
|
662 |
|
|
|
663 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
664 |
|
|
send_gdb "backtrace 100\n"
|
665 |
|
|
if [gdb_expect_list "backtrace from call6j" ".*$gdb_prompt $" {
|
666 |
|
|
".*\[\r\n\]#0 .* call6j \\(ul=8\\) "
|
667 |
|
|
".*\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
|
668 |
|
|
".*\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
|
669 |
|
|
".*\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
|
670 |
|
|
".*\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
671 |
|
|
".*\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
672 |
|
|
".*\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
673 |
|
|
".*\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
674 |
|
|
".*\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
675 |
|
|
".*\[\r\n\]#9 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
676 |
|
|
".*\[\r\n\]#10 .* main \\(.*\\) "
|
677 |
|
|
} ] {
|
678 |
|
|
gdb_suppress_tests;
|
679 |
|
|
}
|
680 |
|
|
|
681 |
|
|
# Continue; should stop at call6k and print actual arguments.
|
682 |
|
|
# Print backtrace.
|
683 |
|
|
# This fails on i960-*-vxworks because gdb gets confused by
|
684 |
|
|
# breakpoints on adjacent instructions.
|
685 |
|
|
setup_xfail "i960-*-vxworks" 1786
|
686 |
|
|
gdb_continue call6k
|
687 |
|
|
|
688 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
689 |
|
|
send_gdb "backtrace 100\n"
|
690 |
|
|
if [gdb_expect_list "backtrace from call6k" ".*$gdb_prompt $" {
|
691 |
|
|
".*\[\r\n\]#0 .* call6k \\(\\) "
|
692 |
|
|
".*\[\r\n\]#1 .* call6j \\(ul=8\\) "
|
693 |
|
|
".*\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
|
694 |
|
|
".*\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
|
695 |
|
|
".*\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
|
696 |
|
|
".*\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
697 |
|
|
".*\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
698 |
|
|
".*\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
699 |
|
|
".*\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
700 |
|
|
".*\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
701 |
|
|
".*\[\r\n\]#10 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
|
702 |
|
|
".*\[\r\n\]#11 .* main \\(.*\\) "
|
703 |
|
|
} ] {
|
704 |
|
|
gdb_suppress_tests;
|
705 |
|
|
}
|
706 |
|
|
gdb_stop_suppressing_tests;
|
707 |
|
|
}
|
708 |
|
|
|
709 |
|
|
|
710 |
|
|
#
|
711 |
|
|
# Locate actual args; shuffle round robin and call
|
712 |
|
|
#
|
713 |
|
|
|
714 |
|
|
proc shuffle_round_robin {} {
|
715 |
|
|
global gdb_prompt
|
716 |
|
|
global hex
|
717 |
|
|
global decimal
|
718 |
|
|
global det_file
|
719 |
|
|
global gcc_compiled
|
720 |
|
|
global hp_cc_compiler
|
721 |
|
|
|
722 |
|
|
delete_breakpoints
|
723 |
|
|
|
724 |
|
|
gdb_breakpoint call7a
|
725 |
|
|
gdb_breakpoint call7b
|
726 |
|
|
gdb_breakpoint call7c
|
727 |
|
|
gdb_breakpoint call7d
|
728 |
|
|
gdb_breakpoint call7e
|
729 |
|
|
gdb_breakpoint call7f
|
730 |
|
|
gdb_breakpoint call7g
|
731 |
|
|
gdb_breakpoint call7h
|
732 |
|
|
|
733 |
|
|
# Run; should stop at call7a and print actual arguments.
|
734 |
|
|
# Print backtrace.
|
735 |
|
|
|
736 |
|
|
gdb_run_cmd
|
737 |
|
|
gdb_expect {
|
738 |
|
|
-re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
|
739 |
|
|
pass "run to call7a"
|
740 |
|
|
}
|
741 |
|
|
-re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
|
742 |
|
|
timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
|
743 |
|
|
}
|
744 |
|
|
|
745 |
|
|
setup_xfail "i960-*-*" 1813
|
746 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
|
747 |
|
|
# The debug info. for "f" is not correct. It's a known bug.
|
748 |
|
|
if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
|
749 |
|
|
send_gdb "backtrace 100\n"
|
750 |
|
|
gdb_expect {
|
751 |
|
|
-re "backtrace 100\[\r\n\]+
|
752 |
|
|
.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
|
753 |
|
|
.* main \\(.*\\) .*\r
|
754 |
|
|
$gdb_prompt $" {
|
755 |
|
|
pass "backtrace from call7a"
|
756 |
|
|
}
|
757 |
|
|
-re "backtrace 100\[\r\n\]+
|
758 |
|
|
.* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
|
759 |
|
|
.* main \\(.*\\) .*\r
|
760 |
|
|
$gdb_prompt $" {
|
761 |
|
|
xfail "backtrace from call7a"
|
762 |
|
|
}
|
763 |
|
|
-re "$gdb_prompt $" { fail "backtrace from call7a" ; return }
|
764 |
|
|
timeout { fail "(timeout) backtrace from call7a" ; return }
|
765 |
|
|
}
|
766 |
|
|
|
767 |
|
|
# Continue; should stop at call7b and print actual arguments.
|
768 |
|
|
# Print backtrace.
|
769 |
|
|
|
770 |
|
|
gdb_continue call7b
|
771 |
|
|
|
772 |
|
|
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
773 |
|
|
|
774 |
|
|
send_gdb "backtrace 100\n"
|
775 |
|
|
gdb_expect_list "backtrace from call7b" ".*$gdb_prompt $" {
|
776 |
|
|
".*\[\r\n\]#0 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
777 |
|
|
".*\[\r\n\]#1 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
778 |
|
|
".*\[\r\n\]#2 .* main \\(.*\\) "
|
779 |
|
|
}
|
780 |
|
|
|
781 |
|
|
# Continue; should stop at call7c and print actual arguments.
|
782 |
|
|
# Print backtrace.
|
783 |
|
|
|
784 |
|
|
gdb_continue call7c
|
785 |
|
|
|
786 |
|
|
send_gdb "backtrace 100\n"
|
787 |
|
|
gdb_expect_list "backtrace from call7c" ".*$gdb_prompt $" {
|
788 |
|
|
".*\[\r\n\]#0 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
789 |
|
|
".*\[\r\n\]#1 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
790 |
|
|
".*\[\r\n\]#2 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
791 |
|
|
".*\[\r\n\]#3 .* main \\(.*\\) "
|
792 |
|
|
}
|
793 |
|
|
|
794 |
|
|
# Continue; should stop at call7d and print actual arguments.
|
795 |
|
|
# Print backtrace.
|
796 |
|
|
|
797 |
|
|
gdb_continue call7d
|
798 |
|
|
|
799 |
|
|
send_gdb "backtrace 100\n"
|
800 |
|
|
gdb_expect_list "backtrace from call7d" ".*$gdb_prompt $" {
|
801 |
|
|
".*\[\r\n\]#0 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
802 |
|
|
".*\[\r\n\]#1 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
803 |
|
|
".*\[\r\n\]#2 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
804 |
|
|
".*\[\r\n\]#3 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
805 |
|
|
".*\[\r\n\]#4 .* main \\(.*\\) "
|
806 |
|
|
}
|
807 |
|
|
|
808 |
|
|
gdb_continue call7e
|
809 |
|
|
|
810 |
|
|
send_gdb "backtrace 100\n"
|
811 |
|
|
gdb_expect_list "backtrace from call7e" ".*$gdb_prompt $" {
|
812 |
|
|
".*\[\r\n\]#0 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
|
813 |
|
|
".*\[\r\n\]#1 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
814 |
|
|
".*\[\r\n\]#2 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
815 |
|
|
".*\[\r\n\]#3 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
816 |
|
|
".*\[\r\n\]#4 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
817 |
|
|
".*\[\r\n\]#5 .* main \\(.*\\) "
|
818 |
|
|
}
|
819 |
|
|
|
820 |
|
|
# Continue; should stop at call7f and print actual arguments.
|
821 |
|
|
# Print backtrace.
|
822 |
|
|
|
823 |
|
|
gdb_continue call7f
|
824 |
|
|
|
825 |
|
|
send_gdb "backtrace 100\n"
|
826 |
|
|
gdb_expect_list "backtrace from call7f" ".*$gdb_prompt $" {
|
827 |
|
|
".*\[\r\n\]#0 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
|
828 |
|
|
".*\[\r\n\]#1 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
|
829 |
|
|
".*\[\r\n\]#2 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
830 |
|
|
".*\[\r\n\]#3 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
831 |
|
|
".*\[\r\n\]#4 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
832 |
|
|
".*\[\r\n\]#5 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
833 |
|
|
".*\[\r\n\]#6 .* main \\(.*\\) "
|
834 |
|
|
}
|
835 |
|
|
|
836 |
|
|
# Continue; should stop at call7g and print actual arguments.
|
837 |
|
|
# Print backtrace.
|
838 |
|
|
|
839 |
|
|
gdb_continue call7g
|
840 |
|
|
|
841 |
|
|
send_gdb "backtrace 100\n"
|
842 |
|
|
gdb_expect_list "backtrace from call7g" ".*$gdb_prompt $" {
|
843 |
|
|
".*\[\r\n\]#0 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
|
844 |
|
|
".*\[\r\n\]#1 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
|
845 |
|
|
".*\[\r\n\]#2 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
|
846 |
|
|
".*\[\r\n\]#3 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
847 |
|
|
".*\[\r\n\]#4 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
848 |
|
|
".*\[\r\n\]#5 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
849 |
|
|
".*\[\r\n\]#6 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
850 |
|
|
".*\[\r\n\]#7 .* main \\(.*\\) "
|
851 |
|
|
}
|
852 |
|
|
|
853 |
|
|
gdb_continue call7h
|
854 |
|
|
|
855 |
|
|
send_gdb "backtrace 100\n"
|
856 |
|
|
gdb_expect_list "backtrace from call7h" ".*$gdb_prompt $" {
|
857 |
|
|
".*\[\r\n\]#0 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
|
858 |
|
|
".*\[\r\n\]#1 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
|
859 |
|
|
".*\[\r\n\]#2 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
|
860 |
|
|
".*\[\r\n\]#3 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
|
861 |
|
|
".*\[\r\n\]#4 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
862 |
|
|
".*\[\r\n\]#5 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
863 |
|
|
".*\[\r\n\]#6 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
864 |
|
|
".*\[\r\n\]#7 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
865 |
|
|
".*\[\r\n\]#8 .* main \\(.*\\) "
|
866 |
|
|
}
|
867 |
|
|
|
868 |
|
|
# monitor only allows 8 breakpoints; w89k board allows 10, so
|
869 |
|
|
# break them up into two groups.
|
870 |
|
|
delete_breakpoints
|
871 |
|
|
gdb_breakpoint call7i
|
872 |
|
|
gdb_breakpoint call7j
|
873 |
|
|
gdb_breakpoint call7k
|
874 |
|
|
|
875 |
|
|
# Continue; should stop at call7i and print actual arguments.
|
876 |
|
|
# Print backtrace.
|
877 |
|
|
|
878 |
|
|
gdb_continue call7i
|
879 |
|
|
|
880 |
|
|
send_gdb "backtrace 100\n"
|
881 |
|
|
gdb_expect_list "backtrace from call7i" ".*$gdb_prompt $" {
|
882 |
|
|
".*\[\r\n\]#0 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
|
883 |
|
|
".*\[\r\n\]#1 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
|
884 |
|
|
".*\[\r\n\]#2 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
|
885 |
|
|
".*\[\r\n\]#3 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
|
886 |
|
|
".*\[\r\n\]#4 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
|
887 |
|
|
".*\[\r\n\]#5 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
888 |
|
|
".*\[\r\n\]#6 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
889 |
|
|
".*\[\r\n\]#7 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
890 |
|
|
".*\[\r\n\]#8 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
891 |
|
|
".*\[\r\n\]#9 .* main \\(.*\\) "
|
892 |
|
|
}
|
893 |
|
|
|
894 |
|
|
# Continue; should stop at call7j and print actual arguments.
|
895 |
|
|
# Print backtrace.
|
896 |
|
|
|
897 |
|
|
gdb_continue call7j
|
898 |
|
|
|
899 |
|
|
send_gdb "backtrace 100\n"
|
900 |
|
|
gdb_expect_list "backtrace from call7j" ".*$gdb_prompt $" {
|
901 |
|
|
".*\[\r\n\]#0 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) "
|
902 |
|
|
".*\[\r\n\]#1 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
|
903 |
|
|
".*\[\r\n\]#2 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
|
904 |
|
|
".*\[\r\n\]#3 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
|
905 |
|
|
".*\[\r\n\]#4 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
|
906 |
|
|
".*\[\r\n\]#5 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
|
907 |
|
|
".*\[\r\n\]#6 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
908 |
|
|
".*\[\r\n\]#7 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
909 |
|
|
".*\[\r\n\]#8 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
910 |
|
|
".*\[\r\n\]#9 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
911 |
|
|
".*\[\r\n\]#10 .* main \\(.*\\) "
|
912 |
|
|
}
|
913 |
|
|
|
914 |
|
|
# Continue; should stop at call7k and print actual arguments.
|
915 |
|
|
# Print backtrace.
|
916 |
|
|
|
917 |
|
|
gdb_continue call7k
|
918 |
|
|
|
919 |
|
|
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
|
920 |
|
|
send_gdb "backtrace 100\n"
|
921 |
|
|
gdb_expect_list "backtrace from call7k" ".*$gdb_prompt $" {
|
922 |
|
|
".*\[\r\n\]#0 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
923 |
|
|
".*\[\r\n\]#1 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) "
|
924 |
|
|
".*\[\r\n\]#2 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
|
925 |
|
|
".*\[\r\n\]#3 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
|
926 |
|
|
".*\[\r\n\]#4 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
|
927 |
|
|
".*\[\r\n\]#5 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
|
928 |
|
|
".*\[\r\n\]#6 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
|
929 |
|
|
".*\[\r\n\]#7 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
|
930 |
|
|
".*\[\r\n\]#8 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
|
931 |
|
|
".*\[\r\n\]#9 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
|
932 |
|
|
".*\[\r\n\]#10 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
|
933 |
|
|
".*\[\r\n\]#11 .* main \\(.*\\) "
|
934 |
|
|
}
|
935 |
|
|
gdb_stop_suppressing_tests;
|
936 |
|
|
}
|
937 |
|
|
|
938 |
|
|
#
|
939 |
|
|
# Locate actual args; recursive passing of structs by value
|
940 |
|
|
#
|
941 |
|
|
|
942 |
|
|
proc recursive_structs_by_value {} {
|
943 |
|
|
global gdb_prompt
|
944 |
|
|
global hex
|
945 |
|
|
global decimal
|
946 |
|
|
global det_file
|
947 |
|
|
|
948 |
|
|
delete_breakpoints
|
949 |
|
|
|
950 |
|
|
gdb_breakpoint hitbottom
|
951 |
|
|
|
952 |
|
|
# Run; should stop at hitbottom and print actual arguments.
|
953 |
|
|
# Print backtrace.
|
954 |
|
|
gdb_run_cmd
|
955 |
|
|
gdb_expect {
|
956 |
|
|
-re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
|
957 |
|
|
-re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
|
958 |
|
|
timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
|
959 |
|
|
}
|
960 |
|
|
|
961 |
|
|
if ![istarget sparclet-*-*] {
|
962 |
|
|
send_gdb "backtrace 100\n"
|
963 |
|
|
gdb_expect_list "recursive passing of structs by value" ".*$gdb_prompt $" {
|
964 |
|
|
".*\[\r\n\]#0 .* hitbottom \\(\\) "
|
965 |
|
|
".*\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
|
966 |
|
|
".*\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
|
967 |
|
|
".*\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
|
968 |
|
|
".*\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
|
969 |
|
|
".*\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
|
970 |
|
|
".*\[\r\n\]#6 .* test_struct_args \\(\\) "
|
971 |
|
|
".*\[\r\n\]#7 .* main \\(.*\\) "
|
972 |
|
|
}
|
973 |
|
|
} else {
|
974 |
|
|
fail "recursive passing of structs by value (sparclet)"
|
975 |
|
|
}
|
976 |
|
|
gdb_stop_suppressing_tests;
|
977 |
|
|
}
|
978 |
|
|
|
979 |
|
|
proc funcargs_reload { } {
|
980 |
|
|
global objdir
|
981 |
|
|
global subdir
|
982 |
|
|
global binfile
|
983 |
|
|
global srcdir
|
984 |
|
|
|
985 |
|
|
if [istarget "mips-idt-*"] {
|
986 |
|
|
# Restart because IDT/SIM runs out of file descriptors.
|
987 |
|
|
gdb_exit
|
988 |
|
|
gdb_start
|
989 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
990 |
|
|
gdb_load ${binfile}
|
991 |
|
|
}
|
992 |
|
|
}
|
993 |
|
|
|
994 |
|
|
#
|
995 |
|
|
# Test for accessing local stack variables in functions which call alloca
|
996 |
|
|
#
|
997 |
|
|
proc localvars_after_alloca { } {
|
998 |
|
|
global gdb_prompt
|
999 |
|
|
global hex
|
1000 |
|
|
global decimal
|
1001 |
|
|
global gcc_compiled
|
1002 |
|
|
|
1003 |
|
|
if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
|
1004 |
|
|
|
1005 |
|
|
# Print each arg as a double check to see if we can print
|
1006 |
|
|
# them here as well as with backtrace.
|
1007 |
|
|
|
1008 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1009 |
|
|
gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
|
1010 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1011 |
|
|
gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
|
1012 |
|
|
gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
|
1013 |
|
|
gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
|
1014 |
|
|
|
1015 |
|
|
# Lame regexp.
|
1016 |
|
|
gdb_test "next" ".*" "next in localvars_after_alloca()"
|
1017 |
|
|
|
1018 |
|
|
# Print each arg as a double check to see if we can print
|
1019 |
|
|
# them here as well as with backtrace.
|
1020 |
|
|
|
1021 |
|
|
gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
|
1022 |
|
|
gdb_test "print s" " = 1" "print s in localvars_after_alloca"
|
1023 |
|
|
gdb_test "print i" " = 2" "print i in localvars_after_alloca"
|
1024 |
|
|
gdb_test "print l" " = 3" "print l in localvars_after_alloca"
|
1025 |
|
|
|
1026 |
|
|
gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
|
1027 |
|
|
gdb_stop_suppressing_tests;
|
1028 |
|
|
}
|
1029 |
|
|
|
1030 |
|
|
proc call_after_alloca { } {
|
1031 |
|
|
global gdb_prompt
|
1032 |
|
|
global hex
|
1033 |
|
|
global decimal
|
1034 |
|
|
global gcc_compiled
|
1035 |
|
|
|
1036 |
|
|
if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
|
1037 |
|
|
|
1038 |
|
|
# Print each arg as a double check to see if we can print
|
1039 |
|
|
# them here as well as with backtrace.
|
1040 |
|
|
|
1041 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1042 |
|
|
gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
|
1043 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1044 |
|
|
gdb_test "print s" " = 1" "print s in call_after_alloca"
|
1045 |
|
|
gdb_test "print i" " = 2" "print i in call_after_alloca"
|
1046 |
|
|
gdb_test "print l" " = 3" "print l in call_after_alloca"
|
1047 |
|
|
|
1048 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1049 |
|
|
gdb_test "backtrace 8" "#0.*call_after_alloca_subr \\(c=97 'a', s=1, i=2, l=3, uc=98 'b', us=11, ui=12, ul=13\\).*#1.*call_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#2.*main.*" "backtrace from call_after_alloca_subr"
|
1050 |
|
|
gdb_stop_suppressing_tests;
|
1051 |
|
|
}
|
1052 |
|
|
|
1053 |
|
|
#
|
1054 |
|
|
# Test for accessing local stack variables, backtraces, finish,
|
1055 |
|
|
# and finally stepping into indirect calls. The point is that on the PA
|
1056 |
|
|
# these use a funky `dyncall' mechanism which GDB needs to know about.
|
1057 |
|
|
#
|
1058 |
|
|
proc localvars_in_indirect_call { } {
|
1059 |
|
|
global gdb_prompt
|
1060 |
|
|
global hex
|
1061 |
|
|
global decimal
|
1062 |
|
|
global gcc_compiled
|
1063 |
|
|
|
1064 |
|
|
# Can not use "runto call0a" as call0a is called several times
|
1065 |
|
|
# during single run. Instead stop in a marker function and
|
1066 |
|
|
# take control from there.
|
1067 |
|
|
if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
|
1068 |
|
|
|
1069 |
|
|
# break on the next call to call0a, then delete all the breakpoints
|
1070 |
|
|
# and start testing.
|
1071 |
|
|
gdb_breakpoint call0a
|
1072 |
|
|
gdb_continue call0a
|
1073 |
|
|
delete_breakpoints
|
1074 |
|
|
|
1075 |
|
|
# Print each arg as a double check to see if we can print
|
1076 |
|
|
# them here as well as with backtrace.
|
1077 |
|
|
|
1078 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1079 |
|
|
gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
|
1080 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1081 |
|
|
gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
|
1082 |
|
|
gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
|
1083 |
|
|
gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
|
1084 |
|
|
|
1085 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1086 |
|
|
gdb_test "backtrace 8" \
|
1087 |
|
|
"#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
|
1088 |
|
|
"backtrace in indirectly called function"
|
1089 |
|
|
|
1090 |
|
|
#
|
1091 |
|
|
# "finish" brings us back to main. We then will try to step through
|
1092 |
|
|
# the second indirect call.
|
1093 |
|
|
# On some targets (e.g. m68k) gdb will stop from the finish in midline
|
1094 |
|
|
# of the first indirect call. This is due to stack adjustment instructions
|
1095 |
|
|
# after the indirect call. In these cases we will step till we hit the
|
1096 |
|
|
# second indirect call.
|
1097 |
|
|
#
|
1098 |
|
|
|
1099 |
|
|
send_gdb "finish\n"
|
1100 |
|
|
gdb_expect {
|
1101 |
|
|
-re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
|
1102 |
|
|
#On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
|
1103 |
|
|
#hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test.
|
1104 |
|
|
send_gdb "step\n"
|
1105 |
|
|
exp_continue
|
1106 |
|
|
}
|
1107 |
|
|
-re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
|
1108 |
|
|
pass "finish from indirectly called function"
|
1109 |
|
|
}
|
1110 |
|
|
-re ".*$gdb_prompt $" {
|
1111 |
|
|
fail "finish from indirectly called function"
|
1112 |
|
|
gdb_suppress_tests;
|
1113 |
|
|
}
|
1114 |
|
|
default { fail "finish from indirectly called function" ; gdb_suppress_tests; }
|
1115 |
|
|
}
|
1116 |
|
|
|
1117 |
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
1118 |
|
|
gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
|
1119 |
|
|
"stepping into indirectly called function"
|
1120 |
|
|
gdb_stop_suppressing_tests;
|
1121 |
|
|
}
|
1122 |
|
|
|
1123 |
|
|
#
|
1124 |
|
|
# Test for stepping into indirect calls which may have trampolines (possibly
|
1125 |
|
|
# cascaded) on both the call path and the gdb_suppress_tests; path.
|
1126 |
|
|
# to handle trampolines.
|
1127 |
|
|
#
|
1128 |
|
|
proc test_stepping_over_trampolines { } {
|
1129 |
|
|
global gdb_prompt
|
1130 |
|
|
global hex
|
1131 |
|
|
global decimal
|
1132 |
|
|
|
1133 |
|
|
# Stop in a marker function and take control from there.
|
1134 |
|
|
if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
|
1135 |
|
|
|
1136 |
|
|
# Cater for gdb stopping in midline, see comment for finish above.
|
1137 |
|
|
send_gdb "finish\n"
|
1138 |
|
|
gdb_expect {
|
1139 |
|
|
-re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
|
1140 |
|
|
send_gdb "step\n"
|
1141 |
|
|
exp_continue
|
1142 |
|
|
}
|
1143 |
|
|
-re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
|
1144 |
|
|
pass "finish from marker_call_with_trampolines"
|
1145 |
|
|
}
|
1146 |
|
|
-re ".*$gdb_prompt $" {
|
1147 |
|
|
fail "finish from marker_call_with_trampolines"
|
1148 |
|
|
}
|
1149 |
|
|
default { fail "finish from marker_call_with_trampolines" ; gdb_suppress_tests; }
|
1150 |
|
|
}
|
1151 |
|
|
|
1152 |
|
|
# Try to step into the target function.
|
1153 |
|
|
gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
|
1154 |
|
|
"stepping into function called with trampolines"
|
1155 |
|
|
|
1156 |
|
|
# Make we can backtrace and the argument looks correct. */
|
1157 |
|
|
gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
|
1158 |
|
|
"backtrace through call with trampolines"
|
1159 |
|
|
|
1160 |
|
|
# Make sure we can get back to main.
|
1161 |
|
|
# Stepping back to main might stop again after the gdb_suppress_tests; statement
|
1162 |
|
|
# or immediately transfer control back to main if optimizations
|
1163 |
|
|
# are performed.
|
1164 |
|
|
send_gdb "step\n"
|
1165 |
|
|
gdb_expect {
|
1166 |
|
|
-re "main .* at.*$gdb_prompt $" {
|
1167 |
|
|
pass "stepping back to main from function called with trampolines" ;
|
1168 |
|
|
gdb_suppress_tests
|
1169 |
|
|
}
|
1170 |
|
|
-re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
|
1171 |
|
|
send_gdb "step\n"
|
1172 |
|
|
exp_continue
|
1173 |
|
|
}
|
1174 |
|
|
-re ".*$gdb_prompt $" {
|
1175 |
|
|
fail "stepping back to main from function called with trampolines"
|
1176 |
|
|
}
|
1177 |
|
|
default { fail "stepping back to main from function called with trampolines" ; gdb_suppress_tests; }
|
1178 |
|
|
}
|
1179 |
|
|
gdb_stop_suppressing_tests;
|
1180 |
|
|
}
|
1181 |
|
|
|
1182 |
|
|
# Start with a fresh gdb.
|
1183 |
|
|
|
1184 |
|
|
gdb_exit
|
1185 |
|
|
gdb_start
|
1186 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
1187 |
|
|
gdb_load ${binfile}
|
1188 |
|
|
|
1189 |
|
|
if [istarget "mips*tx39-*"] {
|
1190 |
|
|
set timeout 300
|
1191 |
|
|
} elseif [istarget "hppa*-hp-hpux*"] then {
|
1192 |
|
|
set timeout 240
|
1193 |
|
|
} else {
|
1194 |
|
|
set timeout 60
|
1195 |
|
|
}
|
1196 |
|
|
|
1197 |
|
|
# Determine expected output for unsigned long variables,
|
1198 |
|
|
# the output varies with sizeof (unsigned long).
|
1199 |
|
|
|
1200 |
|
|
set target_sizeof_long 4
|
1201 |
|
|
send_gdb "print sizeof (long)\n"
|
1202 |
|
|
gdb_expect {
|
1203 |
|
|
-re ".\[0-9\]* = 4.*$gdb_prompt $" { }
|
1204 |
|
|
-re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_long 8 }
|
1205 |
|
|
-re ".*$gdb_prompt $" {
|
1206 |
|
|
fail "getting sizeof long"
|
1207 |
|
|
}
|
1208 |
|
|
default { fail "(timeout) getting sizeof long" }
|
1209 |
|
|
}
|
1210 |
|
|
|
1211 |
|
|
set target_sizeof_int 4
|
1212 |
|
|
send_gdb "print sizeof (int)\n"
|
1213 |
|
|
gdb_expect {
|
1214 |
|
|
-re ".\[0-9\]* = 2.*$gdb_prompt $" { set target_sizeof_int 2 }
|
1215 |
|
|
-re ".\[0-9\]* = 4.*$gdb_prompt $" { }
|
1216 |
|
|
-re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_int 8 }
|
1217 |
|
|
-re ".*$gdb_prompt $" {
|
1218 |
|
|
fail "getting sizeof unsigned long"
|
1219 |
|
|
}
|
1220 |
|
|
default { fail "(timeout) getting sizeof int" }
|
1221 |
|
|
}
|
1222 |
|
|
|
1223 |
|
|
set target_bigendian_p 1
|
1224 |
|
|
send_gdb "show endian\n"
|
1225 |
|
|
gdb_expect {
|
1226 |
|
|
-re ".*little endian.*$gdb_prompt $" { set target_bigendian_p 0 }
|
1227 |
|
|
-re ".*big endian.*$gdb_prompt $" { }
|
1228 |
|
|
-re ".*$gdb_prompt $" {
|
1229 |
|
|
fail "getting target endian"
|
1230 |
|
|
}
|
1231 |
|
|
default { fail "(timeout) getting target endian" }
|
1232 |
|
|
}
|
1233 |
|
|
|
1234 |
|
|
# Perform tests
|
1235 |
|
|
|
1236 |
|
|
integral_args
|
1237 |
|
|
funcargs_reload
|
1238 |
|
|
unsigned_integral_args
|
1239 |
|
|
funcargs_reload
|
1240 |
|
|
if {![target_info exists gdb,skip_float_tests]} {
|
1241 |
|
|
float_and_integral_args
|
1242 |
|
|
}
|
1243 |
|
|
funcargs_reload
|
1244 |
|
|
pointer_args
|
1245 |
|
|
funcargs_reload
|
1246 |
|
|
structs_by_reference
|
1247 |
|
|
funcargs_reload
|
1248 |
|
|
structs_by_value
|
1249 |
|
|
funcargs_reload
|
1250 |
|
|
discard_and_shuffle
|
1251 |
|
|
funcargs_reload
|
1252 |
|
|
shuffle_round_robin
|
1253 |
|
|
funcargs_reload
|
1254 |
|
|
recursive_structs_by_value
|
1255 |
|
|
funcargs_reload
|
1256 |
|
|
localvars_after_alloca
|
1257 |
|
|
funcargs_reload
|
1258 |
|
|
call_after_alloca
|
1259 |
|
|
funcargs_reload
|
1260 |
|
|
localvars_in_indirect_call
|
1261 |
|
|
funcargs_reload
|
1262 |
|
|
test_stepping_over_trampolines
|