* config/tc-m68k.h (md_prepare_relax_scan): Rewrite.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / call-ar-st.exp
CommitLineData
c477543d 1# Copyright 1998, 1999, 2000, 2001
c906108c
SS
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 Elena Zannoni (ezannoni@cygnus.com)
22
23
24if $tracelevel then {
25 strace $tracelevel
26}
27
28set prms_id 0
29set bug_id 0
30
31set testfile "call-ar-st"
32set srcfile ${testfile}.c
33set binfile ${objdir}/${subdir}/${testfile}
34
1960c400
MS
35# Test depends on printf, which the sparclet stub doesn't support.
36if { [istarget "sparclet-*-*"] } {
37 return 0;
38}
c906108c
SS
39
40if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
41 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
42}
43
44
45# Create and source the file that provides information about the compiler
46# used to compile the test case.
47
48if [get_compiler_info ${binfile}] {
49 return -1;
50}
51
52# The a29k can't call functions, so don't even bother with this test.
53if [target_info exists gdb,cannot_call_functions] {
54 setup_xfail "*-*-*" 2416
55 fail "This target can not call functions"
56 continue
57}
58
1b7c05e7
CV
59set oldtimeout $timeout
60set timeout [expr "$timeout + 60"]
61
c906108c
SS
62# Set the current language to C. This counts as a test. If it
63# fails, then we skip the other tests.
64
65proc set_lang_c {} {
66 global gdb_prompt
67
68 send_gdb "set language c\n"
69 gdb_expect {
70 -re ".*$gdb_prompt $" {}
71 timeout { fail "set language c (timeout)" ; return 0; }
72 }
73
74 send_gdb "show language\n"
75 gdb_expect {
76 -re ".* source language is \"c\".*$gdb_prompt $" {
77 pass "set language to \"c\""
78 return 1
79 }
80 -re ".*$gdb_prompt $" {
81 fail "setting language to \"c\""
82 return 0
83 }
84 timeout {
85 fail "can't show language (timeout)"
86 return 0
87 }
88 }
89}
90
c906108c
SS
91source ${binfile}.ci
92
c906108c
SS
93# Start with a fresh gdb.
94
95gdb_exit
96gdb_start
97gdb_reinitialize_dir $srcdir/$subdir
98gdb_load ${binfile}
99send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
100send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
101send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
102
103
104if ![runto_main] then {
105 perror "couldn't run to breakpoint"
106 continue
107}
108
085dd6e6
JM
109#go -until 1209
110gdb_test "tbreak 1209" \
111 "Breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \
112 "tbreakpoint line 1209"
c906108c
SS
113
114gdb_test continue \
085dd6e6 115"Continuing\\..*main \\(\\) at.*$srcfile:1209.*" \
c906108c
SS
116"run until breakpoint set at a line"
117
118
119#call print_double_array(double_array)
13a5e3b8
MS
120if {![gdb_skip_float_test "print print_double_array(double_array)"] && \
121 ![gdb_skip_stdio_test "print print_double_array(double_array)"] } {
9e086581 122 send_gdb "print print_double_array(double_array)\n"
085dd6e6
JM
123 gdb_expect_list "print print_double_array(double_array)" ".*$gdb_prompt $" {
124 "\[ \t\r\n\]+array_d :"
125 "\[ \t\r\n\]+========="
126 "\[ \t\r\n\]+0.000000"
127 "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
1b7c05e7 128 "\[ \t\r\n\]+"
c906108c 129 }
9e086581 130}
c906108c
SS
131
132#call print_char_array(char_array)
7a292a7a 133
13a5e3b8
MS
134if ![gdb_skip_stdio_test "print_char_array(char_array)"] {
135 send_gdb "print print_char_array(char_array)\n"
136 gdb_expect_list "print print_char_array(char_array)" ".*$gdb_prompt $" {
137 "\[ \t\r\n\]+array_c :"
138 "\[ \t\r\n\]+========="
139 "\[ \t\r\n\]+\[ \t\r\n\]+Z"
140 "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
141 "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
142 "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+"
143 }
9ff5cbe9 144}
c906108c
SS
145
146
147
13a5e3b8 148
085dd6e6
JM
149#go -until 1216
150gdb_test "tbreak 1216" \
151"Breakpoint.*file.*$srcfile, line 1216.*" \
152"tbreakpoint line 1216"
c906108c 153
13a5e3b8
MS
154if ![gdb_skip_stdio_test "continue to 1216"] {
155 send_gdb "continue\n"
156 gdb_expect_list "continue to 1216" ".*$gdb_prompt $" {
157 "\[ \t\r\n\]+array_c :"
158 "\[ \t\r\n\]+========="
159 "\[ \t\r\n\]+\[ \t\r\n\]+Z"
160 "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
161 "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
162 "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa"
163 "\[ \t\r\n\]+main.*at.*:1216"
164 "\[ \t\r\n\]+1216.*print_double_array\\(double_array\\)"
165 }
166} else {
167 gdb_test "continue" "" ""
c906108c
SS
168}
169
170# I am disabling this test, because it takes too long. I verified by
171# hand that it works, feel free to check for yourself.
172#call print_all_arrays(integer_array, char_array, float_array, double_array)
173#send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n"
174#gdb_expect {
175# -re ".*array_i :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0\[ \t\r\n\]+-1 -2 -3 -4 -5 -6 -7 -8\[ \t\r\n\]+-9 -10 -11 -12 -13 -14 -15 -16\[ \t\r\n\]+-17 -18 -19 -20 -21 -22 -23 -24\[ \t\r\n\]+-25 -26 -27 -28 -29 -30 -31 -32\[ \t\r\n\]+-33 -34 -35 -36 -37 -38 -39 -40\[ \t\r\n\]+-41 -42 -43 -44 -45 -46 -47 -48\[ \t\r\n\]+-49\[ \t\r\n\]+\[ \t\r\n\]+array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+array_f :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+0.142450 0.284900 0.427350 0.569801 0.712251 0.854701 0.997151 1.139601\[ \t\r\n\]+1.282051 1.424501 1.566952 1.709402 1.851852 1.994302\[ \t\r\n\]+\[ \t\r\n\]+array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.41750 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300.*$gdb_prompt $" {
176# pass "print print_all_arrays(integer_array, char_array, float_array, double_array)"
177# }
178# -re ".*$gdb_prompt $" { fail "print print_all_arrays(integer_array, char_array, float_array, double_array)" }
179# timeout { fail "(timeout) print print_all_arrays(integer_array, char_array, float_array, double_array)" }
180# }
181
182#set timeout $oldtimeout
085dd6e6
JM
183#go -until 1220
184gdb_test "tbreak 1220" \
13a5e3b8
MS
185 "Breakpoint.* file .*$srcfile, line 1220.*" \
186 "tbreakpoint line 1220"
187
c477543d
SC
188if {![gdb_skip_float_test "continuing to breakpoint 1220"] && \
189 ![gdb_skip_stdio_test "continuing to breakpoint 1220"] } {
13a5e3b8
MS
190 send_gdb "continue\n"
191 gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" {
192 "Continuing\\."
193 "\[ \t\r\n\]+array_d :"
194 "\[ \t\r\n\]+========="
195 "\[ \t\r\n\]+0.000000"
196 "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
1b7c05e7 197 "\[ \t\r\n\]+"
13a5e3b8
MS
198 ".*array_f :"
199 ".*student id :\[\t \]+.*YELLOW"
200 ".*array_i :"
201 ".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)."
202 }
203} else {
204 gdb_test "continue" "" ""
085dd6e6 205}
c906108c
SS
206
207#step
13a5e3b8
MS
208send_gdb "step\n"
209gdb_expect {
210 -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"}
211 -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" }
212 timeout { fail "step inside print_all_arrays (timeout)" }
213}
c906108c
SS
214
215
216#step -over
13a5e3b8 217if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
c906108c
SS
218 send_gdb "next\n"
219 gdb_expect {
13a5e3b8
MS
220 -re "array_i :.*307.*print_char_array.*$gdb_prompt $" {
221 pass "next over print_int_array in print-all_arrays"
222 }
223 -re ".*$gdb_prompt $" {
224 fail "next over print_int_array in print-all_arrays"
225 }
226 timeout {
227 fail "next over print_int_array in print-all_arrays (timeout)"
228 }
c906108c 229 }
13a5e3b8
MS
230} else {
231 gdb_test "next" "" ""
232}
c906108c
SS
233
234#call print_double_array(array_d)
13a5e3b8
MS
235if {![gdb_skip_float_test "print print_double_array(array_d)"] && \
236 ![gdb_skip_stdio_test "print print_double_array(array_d)"] } {
237 send_gdb "print print_double_array(array_d)\n"
238 gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" {
239 "array_d :"
240 "\[ \t\r\n\]+========="
241 "\[ \t\r\n\]+\[ \t\r\n\]+0.000000"
242 "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
1b7c05e7 243 "\[ \t\r\n\]+"
13a5e3b8 244 }
9e086581 245}
c906108c 246
085dd6e6
JM
247#go -until 1236
248gdb_test "tbreak 1236" \
249"Breakpoint.* file .*$srcfile, line 1236.*" \
250"tbreakpoint line 1236"
c906108c 251
c477543d
SC
252if {![gdb_skip_float_test "continuing to 1236"] && \
253 ![gdb_skip_stdio_test "continuing to 1236"] } {
13a5e3b8
MS
254 send_gdb "continue\n"
255 gdb_expect_list "continuing to 1236" ".*$gdb_prompt $" {
256 "Continuing\\..*array_c"
257 ".*array_f"
258 "\[ \t\r\n\]+array_d :"
259 "\[ \t\r\n\]+========="
260 "\[ \t\r\n\]+0.000000"
261 "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
1b7c05e7 262 "\[ \t\r\n\]+.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)."
13a5e3b8
MS
263 }
264} else {
265 gdb_test "continue" "" ""
085dd6e6 266}
c906108c
SS
267
268
269#call sum_array_print(10, *list1, *list2, *list3, *list4)
b83266a0 270
13a5e3b8
MS
271if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
272 send_gdb "print sum_array_print(10, *list1, *list2, *list3, *list4)\n"
273 gdb_expect {
274 -re ".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*$gdb_prompt $" {
275 pass "print sum_array_print(10, *list1, *list2, *list3, *list4)"
276 }
277 -re ".*$gdb_prompt $" { fail "print sum_array_print(10, *list1, *list2, *list3, *list4)" }
278 timeout { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
279 }
280}
c906108c 281
b83266a0 282#step over
13a5e3b8
MS
283if ![gdb_skip_stdio_test "next to 1237"] {
284 send_gdb "next\n"
285 gdb_expect {
286 -re ".*BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1237"}
287 -re ".*$gdb_prompt $" { fail "next to 1237" }
288 timeout { fail "next to 1237(timeout)" }
289 }
290} else {
291 gdb_test "next" "" ""
b83266a0 292}
c906108c
SS
293
294#call print_array_rep(\*list1, \*list2, \*list3)
295
13a5e3b8
MS
296if ![gdb_skip_stdio_test "print print_array_rep(...)"] {
297 send_gdb "print print_array_rep(\*list1, \*list2, \*list3)\n"
298 gdb_expect {
299 -re ".*$gdb_prompt $" {
300 pass "print print_array_rep(*list1, *list2, *list3)"
301 }
302 -re ".*$gdb_prompt $" {
303 fail "print print_array_rep(*list1, *list2, *list3)"
304 }
305 timeout {
306 fail "(timeout) print print_array_rep(*list1, *list2, *list3)"
307 }
308 }
309}
c906108c 310
085dd6e6
JM
311#go -until 1241
312gdb_test "tbreak 1241" \
313 "Breakpoint..* file .*$srcfile, line 1241.*" \
314 "tbreakpoint line 1241"
c906108c
SS
315
316send_gdb "continue\n"
317gdb_expect {
53a5351d 318 -re ".*main \\(\\) at .*call-ar-st.c:1241\r\n1241\[\t \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" {
085dd6e6
JM
319 pass "continue to 1241"}
320 -re ".*$gdb_prompt $" { fail "continue to 1241"}
321 timeout { fail "(timeout) continue to 1241"}
c906108c
SS
322}
323
324
325
326# Run into sum_array_print, and verify that the arguments were passed
327# accurately.
328#
329# Note that we shouldn't use a `step' here to get into
330# sum_array_print; GCC may emit calls to memcpy to put the arguments
331# in the right place, and a step may end up in memcpy instead. This
332# may itself be a bug, but it's not the one we're trying to catch
333# here. I've added something to step-test.exp for this.
334gdb_test "break sum_array_print" \
335 ".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \
336 "set breakpoint in sum_array_print"
337gdb_test "continue" \
085dd6e6 338 ".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:1105\[ \t\n\r\]+1105.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \
c906108c
SS
339 "check args of sum_array_print"
340
341#call print_array_rep(linked_list1, linked_list2, linked_list3)
342# this calls works from gdb without gdb_expect. But it does seem to hang
343#from within gdb_expect.
344#I comment this out
345#send_gdb "print print_array_rep(linked_list1, linked_list2, linked_list3)\n"
346#gdb_expect {
347# -re ".*Contents of linked list1:\[ \t\n\r\]+Element Value . Index of Next Element\[ \t\n\r\]+-------------------------------------\[ \t\n\r\]+.*\[ \t\n\r\]+.*4.*1\[ \t\n\r\]+.*6.*2\[ \t\n\r\]+.*8.*3\[ \t\n\r\]+.*10.*4\[ \t\n\r\]+.*12.*5\[ \t\n\r\]+.*14.*6\[ \t\n\r\]+.*16.*7\[ \t\n\r\]+.*18.*8\[ \t\n\r\]+.*20.*9\[ \t\n\r\]+.*22.*10\[ \t\n\r\]+Contents of linked list2:\[ \t\n\r\]+Element Value | Index of Next Element\[ \t\n\r\]+-------------------------------------\[ \t\n\r\]+.*\[ \t\n\r\]+.*8.*1\[ \t\n\r\]+.*10.*2\[ \t\n\r\]+.*12.*3\[ \t\n\r\]+.*14.*4\[ \t\n\r\]+.*16.*5\[ \t\n\r\]+.*18.*6\[ \t\n\r\]+.*20.*7\[ \t\n\r\]+.*22.*8\[ \t\n\r\]+.*24.*9\[ \t\n\r\]+.*26.*10\[ \t\n\r\]+Contents of linked list3:\[ \t\n\r\]+Element Value | Index of Next Element\[ \t\n\r\]+-------------------------------------\[ \t\n\r\]+.*\[ \t\n\r\]+.*10.*1\[ \t\n\r\]+.*12.*2\[ \t\n\r\]+.*14.*3\[ \t\n\r\]+.*16.*4\[ \t\n\r\]+.*18.*5\[ \t\n\r\]+.*20.*6\[ \t\n\r\]+.*22.*7\[ \t\n\r\]+.*24.*8\[ \t\n\r\]+.*26.*9\[ \t\n\r\]+.*28.*10\[ \t\n\r\]+.*$gdb_prompt $" {
348# pass "print print_array_rep(linked_list1, linked_list2, linked_list3)"
349# }
350# -re ".*$gdb_prompt $" { fail "print print_array_rep(linked_list1, linked_list2, linked_list3)" }
351# timeout { fail "(timeout) print print_array_rep(linked_list1, linked_list2, linked_list3)" }
352#}
353
354
085dd6e6
JM
355#go -until 1281
356gdb_test "tbreak 1281" \
357 "Breakpoint.* file .*call-ar-st.c, line 1281.*" \
358 "tbreakpoint line 1281"
c906108c 359
13a5e3b8
MS
360if ![gdb_skip_stdio_test "continuing to 1281"] {
361 send_gdb "continue\n"
362 gdb_expect {
363 -re "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*$gdb_prompt $" {
364 pass "continue to 1281"
365 }
366 -re ".*$gdb_prompt $" { fail "continue to 1281"}
367 timeout { fail "(timeout) continue to 1281"}
368 }
369} else {
370 gdb_test "continue" "" ""
c906108c
SS
371}
372
13a5e3b8
MS
373#call print_small_structs(*struct1, *struct2, *struct3, *struct4,
374# *flags, *flags_combo, *three_char, *five_char,
375# *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
376
377if {![gdb_skip_float_test "print print_small_structs(...)"] && \
378 ![gdb_skip_stdio_test "print print_small_structs(...)"] } {
9ff5cbe9
AC
379 send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
380 gdb_expect_list "print print_small_structs" ".*$gdb_prompt $" {
381 "\[\t\r\n \]+alpha"
382 "\[\t\r\n \]+gamma"
383 "\[\t\r\n \]+epsilon"
384 "\[\t\r\n \]+alpha"
385 "\[\t\r\n \]+gamma"
386 "\[\t\r\n \]+epsilon"
387 "\[\t\r\n \]+ch1: y[ \t]*ch2: n"
388 "\[\t\r\n \]+Contents of three_char_t:"
389 "\[\t\r\n \]+a[ \t]*b[ \t]*c"
390 "\[\t\r\n \]+Contents of five_char_t:"
391 "\[\t\r\n \]+l[ \t]*m[ \t]*n[ \t]*o[ \t]*p"
392 "\[\t\r\n \]+Contents of int_char_combo_t:"
393 "\[\t\r\n \]+123[ \t]*z"
394 "\[\t\r\n \]+Sum of the 4 struct values and seed :"
395 "\[\t\r\n \]+52"
396 "\[\t\r\n \]+Contents of struct1:"
397 "\[\t\r\n \]+6[ \t]*0"
398 "\[\t\r\n \]+Contents of struct2:"
399 "\[\t\r\n \]+10[ \t]*0"
400 "\[\t\r\n \]+Contents of struct3:"
401 "\[\t\r\n \]+12[ \t]*0"
402 "\[\t\r\n \]+Contents of one_double_t:"
403 "\[\t\r\n \]+10.500000"
404 "\[\t\r\n \]+Contents of one_double_t:"
405 "\[\t\r\n \]+-3.375000"
406 "\[\t\r\n \]+Contents of one_double_t:"
407 "\[\t\r\n \]+675.093750"
408 "\[\t\r\n \]+Contents of two_floats_t:"
409 "\[\t\r\n \]+45.234001[ \t]*43.599998"
410 "\[\t\r\n \]+Contents of two_floats_t:"
411 "\[\t\r\n \]+78.010002[ \t]*122.099998"
412 "\[\t\r\n \]+Contents of two_floats_t:"
413 "\[\t\r\n \]+-1232.344971[ \t]*-199.210007"
9e086581 414 }
9e086581 415}
c906108c
SS
416
417#call compute_with_small_structs(20)
418send_gdb "print compute_with_small_structs(20)\n"
419gdb_expect {
420 -re ".*\[0-9\]+ =.*$gdb_prompt $" {
421 pass "print compute_with_small_structs(20)"
422 }
423 -re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" }
424 timeout { fail "(timeout) compute_with_small_structs(20)" }
425 }
426
427
13a5e3b8
MS
428#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098,
429# 3.14, -5678.12345, -0.11111111, 216.97065)
430
431if {![gdb_skip_float_test "print print_ten_doubles(...)"] && \
432 ![gdb_skip_stdio_test "print print_ten_doubles(...)"]} {
9ff5cbe9
AC
433 send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n"
434 gdb_expect_list "print print_ten_doubles" ".*$gdb_prompt $" {
435 "\[\t\r\n \]+Two Doubles : 123.456000.*123.456000"
436 "\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000"
437 "\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000"
438 "\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450"
439 "\[\t\r\n \]+Two Doubles : -0.111111.*216.970650"
9e086581 440 }
9e086581 441}
c906108c 442
085dd6e6
JM
443#go -until 1286
444gdb_test "tbreak 1286" \
445 "Breakpoint .* file .*call-ar-st.c, line 1286.*" \
446 "tbreakpoint line 1286"
447
448gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1286\[\t\r\n \]+1286.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1286"
449
450if { [istarget "hppa*-*-hpux*"] } {
451 #
452 # NOTE:(FIXME)
453 # the aCC demangler cannot demangle the name of a function with >10 args.
454 # so I added a .* after the name of the function, to match the
455 # incredibly long mangled name
456 # (getting aCC's libdemangle.a bundled w/ the system?)
457 # DTS CLLbs16994 coulter 990114
458 #
459 # FIXME: use step for hppa* testing for now
460 # guo 990621
461 #
462 send_gdb "step\n"
463 gdb_expect {
591b8fa3 464 -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"}
085dd6e6
JM
465 -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
466 timeout { fail "step into print_long_arg_list (timeout)" }
467 }
9e086581 468} else {
085dd6e6 469
53a5351d
JM
470 # We can't just assume that a "step" will get us into
471 # print_long_arg_list here,either.
085dd6e6
JM
472 gdb_test "tbreak print_long_arg_list" \
473 "Breakpoint .* file .*call-ar-st.c, line .*" \
474 "tbreak in print_long_arg_list after stepping into memcpy"
53a5351d
JM
475 # The short match case below handles cases where a buffer
476 # overflows or something, and expect can't deal with the full
477 # line. Perhaps a more elegant solution exists... -sts 1999-08-17
085dd6e6 478 send_gdb "continue\n"
13a5e3b8 479 if {![gdb_skip_float_test "step into print_long_arg_list"]} {
085dd6e6 480 gdb_expect {
591b8fa3
PDM
481 -re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" { pass "step into print_long_arg_list" }
482 -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}.*\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list (short match)"}
085dd6e6
JM
483 -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
484 timeout { fail "step into print_long_arg_list (timeout)" }
485 }
486 } else {
53a5351d 487 # If skipping float tests, don't expect anything in arg list.
085dd6e6
JM
488 gdb_expect {
489 -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" }
490 -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
491 timeout { fail "step into print_long_arg_list (timeout)" }
492 }
493 }
9e086581 494}
c906108c 495
53a5351d
JM
496set ws "\[\n\r\t \]+"
497
13a5e3b8
MS
498#call print_small_structs(struct1, struct2, struct3, struct4, flags,
499# flags_combo, three_char, five_char, int_char_combo,
500# d1, d2, d3, f1, f2, f3)
501
502if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \
503 ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } {
53a5351d
JM
504 # On Solaris, some of the args are passed by ref, others by value,
505 # and GDB gets confused and says "Invalid cast" because it thinks
506 # it has to cast the structure into a pointer to structure. A real
507 # GDB bug, probably for all Sparc configs, but obscure. -sts 1999-08-17.
508 setup_xfail "sparc*-*-solaris*"
509 send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n"
49a2cef8
AC
510 gdb_expect_list "print print_small_structs from print_long_arg_list" ".*$gdb_prompt $" {
511 "\[\t\r\n \]+alpha"
512 "\[\t\r\n \]+gamma"
513 "\[\t\r\n \]+epsilon"
514 "\[\t\r\n \]+alpha"
515 "\[\t\r\n \]+gamma"
516 "\[\t\r\n \]+epsilon"
517 "\[\t\r\n \]+ch1: y[ \t]*ch2: n"
518 "\[\t\r\n \]+Contents of three_char_t:"
519 "\[\t\r\n \]+a\[ \t\]*b\[ \t\]*c"
520 "\[\t\r\n \]+Contents of five_char_t:"
521 "\[\t\r\n \]+l\[ \t\]*m\[ \t\]*n\[ \t\]*o\[ \t\]*p"
522 "\[\t\r\n \]+Contents of int_char_combo_t:"
523 "\[\t\r\n \]+123\[ \t\]*z"
524 "\[\t\r\n \]+Sum of the 4 struct values and seed :"
525 "\[\t\r\n \]+52"
526 "\[\t\r\n \]+Contents of struct1:"
527 "\[\t\r\n \]+6\[ \t\]*0"
528 "\[\t\r\n \]+Contents of struct2:"
529 "\[\t\r\n \]+10\[ \t\]*0"
530 "\[\t\r\n \]+Contents of struct3:"
531 "\[\t\r\n \]+12\[ \t\]*0"
532 "\[\t\r\n \]+Contents of one_double_t:"
533 "\[\t\r\n \]+10.500000"
534 "\[\t\r\n \]+Contents of one_double_t:"
535 "\[\t\r\n \]+-3.375000"
536 "\[\t\r\n \]+Contents of one_double_t:"
537 "\[\t\r\n \]+675.093750"
538 "\[\t\r\n \]+Contents of two_floats_t:"
539 "\[\t\r\n \]+45.234001\[ \t\]*43.599998"
540 "\[\t\r\n \]+Contents of two_floats_t:"
541 "\[\t\r\n \]+78.010002\[ \t\]*122.099998"
542 "\[\t\r\n \]+Contents of two_floats_t:"
543 "\[\t\r\n \]+-1232.344971\[ \t\]*-199.210007"
9e086581 544 }
9e086581 545}
c906108c
SS
546
547
085dd6e6
JM
548#go -until 1300
549gdb_test "tbreak 1300" \
550 "Breakpoint.* file .*call-ar-st.c, line 1300.*" \
551 "tbreakpoint line 1300"
552
13a5e3b8
MS
553if ![gdb_skip_stdio_test "continuing to 1300"] {
554 gdb_test "continue" "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
555 "continue to 1300"
556} else {
557 gdb_test "continue" "" ""
558}
085dd6e6 559
c906108c
SS
560#step
561 send_gdb "step\n"
562 gdb_expect {
563 -re "
085dd6e6 564init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" {
c906108c
SS
565 pass "step into init_bit_flags_combo"}
566 -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" }
567 timeout { fail "step into init_bit_flags_combo (timeout)" }
568 }
569
570#call print_bit_flags_combo(*bit_flags_combo)
13a5e3b8
MS
571if ![gdb_skip_stdio_test "continuing to 1300"] {
572 send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
573 gdb_expect {
574 -re ".*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*$gdb_prompt $" {
575 pass "print print_bit_flags_combo from init_bit_flags_combo"
576 }
577 -re ".*$gdb_prompt $" {
578 fail "print print_bit_flags_combo from init_bit_flags_combo"
579 }
580 timeout {
581 fail "(timeout) print_bit_flags_combo from init_bit_flags_combo"
582 }
583 }
584}
c906108c
SS
585
586
085dd6e6
JM
587#go -until 1305
588gdb_test "tbreak 1305" \
589 "Breakpoint.* file .*call-ar-st.c, line 1305.*" \
590 "tbreakpoint line 1305"
c906108c 591
085dd6e6
JM
592gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1305\[\r\n\t \]+1305.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \
593"continue to 1305"
c906108c
SS
594
595#call print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
a0b3c4fd
JM
596
597# FIXME:
598# HP aCC demangler currently does not handle hp aCC functions with >10 args
599# DTS CLLbs16994 coulter 990114
600
601if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*" CLLbs16994}
602
13a5e3b8
MS
603if {![gdb_skip_float_test "print print_long_arg_list"] && \
604 ![gdb_skip_stdio_test "print print_long_arg_list"] } {
9ff5cbe9
AC
605 send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
606 gdb_expect_list "print print_long_arg_list" ".*$gdb_prompt $" {
607 "\[ \n\r\t\]+double : 22.250000"
608 "\[ \n\r\t\]+double : 33.375000"
609 "\[ \n\r\t\]+int : 0"
610 "\[ \n\r\t\]+int : -25"
611 "\[ \n\r\t\]+int : 100"
612 "\[ \n\r\t\]+int : 2345"
613 "\[ \n\r\t\]+alpha"
614 "\[ \n\r\t\]+gamma"
615 "\[ \n\r\t\]+epsilon"
616 "\[ \n\r\t\]+ch1: y\[ \t\]+ch2: n"
617 "\[ \n\r\t\]+Contents of three_char_t:"
618 "\[ \n\r\t\]+x\[ \t\]+y\[ \t\]+z"
619 "\[ \n\r\t\]+Contents of five_char_t:"
620 "\[ \n\r\t\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o"
621 "\[ \n\r\t\]+Contents of int_char_combo_t:"
622 "\[ \n\r\t\]+123\[ \t\]+z"
623 "\[ \n\r\t\]+Sum of the 4 struct values and seed :"
624 "\[ \n\r\t\]+52"
625 "\[ \n\r\t\]+Contents of struct1:"
626 "\[ \n\r\t\]+6\[ \t\]+0"
627 "\[ \n\r\t\]+Contents of struct2:"
628 "\[ \n\r\t\]+10\[ \t\]+0"
629 "\[ \n\r\t\]+Contents of struct3:"
630 "\[ \n\r\t\]+12\[ \t\]+0"
631 "\[ \n\r\t\]+Contents of one_double_t:"
632 "\[ \n\r\t\]+1.111110"
633 "\[ \n\r\t\]+Contents of one_double_t:"
634 "\[ \n\r\t\]+-345.340000"
635 "\[ \n\r\t\]+Contents of one_double_t:"
636 "\[ \n\r\t\]+546464.200000"
637 "\[ \n\r\t\]+Contents of two_floats_t:"
638 "\[ \n\r\t\]+0.234000\[ \t\]+453.100006"
639 "\[ \n\r\t\]+Contents of two_floats_t:"
640 "\[ \n\r\t\]+78.345001\[ \t\]+23.090000"
641 "\[ \n\r\t\]+Contents of two_floats_t:"
642 "\[ \n\r\t\]+-2.345000\[ \t\]+1.000000"
9e086581 643 }
9e086581 644}
c906108c
SS
645
646
085dd6e6
JM
647#go -until 1311
648gdb_test "tbreak 1311" \
649 "Breakpoint.* file .*call-ar-st.c, line 1311.*" \
650 "tbreakpoint line 1311"
c906108c 651
085dd6e6
JM
652gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1311\[ \t\n\r\]+1311.*compute_with_small_structs\\(35\\);" \
653"continue to 1311"
c906108c
SS
654
655
656#call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
13a5e3b8
MS
657if ![gdb_skip_stdio_test "print sum_struct_print(...)"] {
658 send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n"
659 gdb_expect {
660 -re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" {
661 pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
662 }
663 -re ".*$gdb_prompt $" {
664 fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
665 }
666 timeout {
667 fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
668 }
669 }
670}
c906108c
SS
671
672
673#call print_struct_rep(*struct1, *struct2, *struct3)
13a5e3b8
MS
674if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
675 send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n"
676 gdb_expect_list "print print_struct_rep(*struct1, *struct2, *struct3)" \
677 ".*$gdb_prompt $" {
678 "\[ \t\n\r\]+Contents of struct1:"
679 "\[ \t\n\r\]+ 22 0"
680 "\[ \t\n\r\]+Contents of struct2:"
681 "\[ \t\n\r\]+ 42 0"
682 "\[ \t\n\r\]+Contents of struct3:"
683 "\[ \t\n\r\]+ 62 0"
684 }
9ff5cbe9 685}
c906108c 686
13a5e3b8
MS
687if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
688 send_gdb "print print_one_large_struct(*list1)\n"
689 gdb_expect {
690 -re ".* 4 1.*$gdb_prompt $" {
691 pass "print print_one_large_struct(*list1)"
692 }
693 -re ".*$gdb_prompt $" {
694 fail "print print_one_large_struct(*list1)"
695 }
696 timeout {
697 fail "(timeout) print_one_large_struct(*list1)"
698 }
699 }
700}
c906108c 701
1b7c05e7 702set timeout $oldtimeout
c906108c
SS
703return
704
This page took 0.217019 seconds and 4 git commands to generate.