Make gdb.base/call-ar-st.exp use gdb_test_stdio
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / call-ar-st.exp
1 # Copyright 1998-2015 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
18
19
20 standard_testfile
21
22 # Test depends on printf, which the sparclet stub doesn't support.
23 if { [istarget "sparclet-*-*"] } {
24 return 0
25 }
26
27 # Some targets can't call functions, so don't even bother with this
28 # test.
29 if [target_info exists gdb,cannot_call_functions] {
30 setup_xfail "*-*-*" 2416
31 fail "This target can not call functions"
32 continue
33 }
34
35 # Create and source the file that provides information about the compiler
36 # used to compile the test case.
37
38 if [get_compiler_info] {
39 return -1
40 }
41
42 if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
43 untested $testfile.exp
44 return -1
45 }
46
47
48 set oldtimeout $timeout
49 set timeout [expr "$timeout + 60"]
50
51 gdb_test_no_output "set print sevenbit-strings"
52 gdb_test_no_output "set print address off"
53 gdb_test_no_output "set width 0"
54
55
56 if ![runto_main] then {
57 perror "couldn't run to breakpoint"
58 continue
59 }
60
61 get_debug_format
62
63 set stop_line [gdb_get_line_number "-tbreak1-"]
64 gdb_test "tbreak $stop_line" \
65 "Temporary breakpoint ${decimal}.*file.*$srcfile, line $stop_line.*" \
66 "tbreakpoint at tbreak1"
67
68 gdb_test continue \
69 "Continuing\\..*main \\(\\) at.*$srcfile:$stop_line.*" \
70 "run until breakpoint set at a line"
71
72
73 #call print_double_array(double_array)
74 if {![gdb_skip_float_test "print print_double_array(double_array)"] && \
75 ![gdb_skip_stdio_test "print print_double_array(double_array)"] } {
76
77 gdb_test_stdio "print print_double_array(double_array)" \
78 [multi_line \
79 "array_d :" \
80 "=========" \
81 "" \
82 "0.000000 *" \
83 "23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]"]
84 }
85
86 #call print_char_array(char_array)
87
88 set array_c_re \
89 [multi_line \
90 "array_c :" \
91 "=========" \
92 "" \
93 "Z" \
94 "aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" \
95 "aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" \
96 "aZaZaZaZaZaZaZaZaZa"]
97
98 if ![gdb_skip_stdio_test "print_char_array(char_array)"] {
99 gdb_test_stdio "print print_char_array(char_array)" $array_c_re
100 }
101
102 set stop_line [gdb_get_line_number "-tbreak2-"]
103 gdb_test "tbreak $stop_line" \
104 "Temporary breakpoint.*file.*$srcfile, line $stop_line.*" \
105 "tbreakpoint at tbreak2"
106
107 if ![gdb_skip_stdio_test "continue to tbreak2"] {
108 set gdb_re \
109 [multi_line \
110 "main.*at.*:\[0-9\]+" \
111 "\[0-9\]+.*print_double_array\\(double_array\\).*"]
112 gdb_test_stdio "continue" $array_c_re $gdb_re "continue to tbreak2"
113 } else {
114 gdb_test "continue" ".*" ""
115 }
116
117 # I am disabling this test, because it takes too long. I verified by
118 # hand that it works, feel free to check for yourself.
119 #call print_all_arrays(integer_array, char_array, float_array, double_array)
120 #send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n"
121 #gdb_expect {
122 # -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 $" {
123 # pass "print print_all_arrays(integer_array, char_array, float_array, double_array)"
124 # }
125 # -re ".*$gdb_prompt $" { fail "print print_all_arrays(integer_array, char_array, float_array, double_array)" }
126 # timeout { fail "(timeout) print print_all_arrays(integer_array, char_array, float_array, double_array)" }
127 # }
128
129 #set timeout $oldtimeout
130 set stop_line [gdb_get_line_number "-tbreak3-"]
131 gdb_test "tbreak $stop_line" \
132 "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
133 "tbreakpoint at tbreak3"
134
135 if {![gdb_skip_float_test "continuing to tbreak3"] && \
136 ![gdb_skip_stdio_test "continuing to tbreak3"] } {
137
138 gdb_test_stdio "continue" \
139 [multi_line \
140 "array_d :" \
141 "=========" \
142 "" \
143 "0.000000 *" \
144 "23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]* *" \
145 "" \
146 "" \
147 "array_f :" \
148 ".*" \
149 "student id :\[\t \]+.*YELLOW" \
150 "array_i :" \
151 ] \
152 "main \\(\\) at .*call-ar-st.c:\[0-9\]+\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)..*" \
153 "continuing to tbreak3"
154
155 } else {
156 gdb_test "continue" ".*" ""
157 }
158
159 #step
160 set stop_line [gdb_get_line_number "-step1-"]
161 gdb_test "step" \
162 "print_all_arrays \\(array_i=<integer_array.*>, array_c=<char_array.*> .ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=<float_array.*>, array_d=<double_array.*>\\) at .*$srcfile:$stop_line\[ \t\r\n\]+$stop_line.*print_int_array\\(array_i\\);.*" \
163 "step inside print_all_arrays"
164
165 #step -over
166 if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
167 set stop_line [gdb_get_line_number "-next1-"]
168 gdb_test_stdio "next" \
169 "array_i :" \
170 "$stop_line.*print_char_array.*" \
171 "next over print_int_array in print-all_arrays"
172 } else {
173 gdb_test "next" ".*" ""
174 }
175
176 #call print_double_array(array_d)
177 if {![gdb_skip_float_test "print print_double_array(array_d)"] && \
178 ![gdb_skip_stdio_test "print print_double_array(array_d)"] } {
179
180 gdb_test_stdio "print print_double_array(array_d)" \
181 [multi_line \
182 "array_d :" \
183 "=========" \
184 "" \
185 "0.000000 *" \
186 "23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*" \
187 ]
188 }
189
190 set stop_line [gdb_get_line_number "-tbreak4-"]
191 gdb_test "tbreak $stop_line" \
192 "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
193 "tbreakpoint at tbreak4"
194
195 if {![gdb_skip_float_test "continuing to tbreak4"] && \
196 ![gdb_skip_stdio_test "continuing to tbreak4"] } {
197
198 gdb_test_stdio "continue" \
199 [multi_line \
200 "array_d :" \
201 "=========" \
202 "" \
203 "0.000000 *" \
204 "23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*" \
205 ] \
206 "" \
207 "continuing to tbreak4"
208 } else {
209 gdb_test "continue" ".*" ""
210 }
211
212
213 #call sum_array_print(10, *list1, *list2, *list3, *list4)
214
215 if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
216
217 gdb_test_stdio "print sum_array_print(10, *list1, *list2, *list3, *list4)" \
218 [multi_line \
219 "Sum of 4 arrays, by element \\(add in seed as well\\): " \
220 "" \
221 "Seed: 10" \
222 "Element Index . Sum " \
223 "-------------------------" \
224 ".*" \
225 "\[ \t\]+0\[ \t\]+52" \
226 "\[ \t\]+1\[ \t\]+60" \
227 "\[ \t\]+2\[ \t\]+68" \
228 "\[ \t\]+3\[ \t\]+76" \
229 "\[ \t\]+4\[ \t\]+84" \
230 "\[ \t\]+5\[ \t\]+92" \
231 "\[ \t\]+6\[ \t\]+100" \
232 "\[ \t\]+7\[ \t\]+108" \
233 "\[ \t\]+8\[ \t\]+116" \
234 "\[ \t\]+9\[ \t\]+124" \
235 ]
236 }
237
238 #step over
239 set stop_line [gdb_get_line_number "-next2-"]
240 if ![gdb_skip_stdio_test "next to next2"] {
241 gdb_test_stdio "next" \
242 "BYE BYE FOR NOW" \
243 "$stop_line.*printf\\(.VERY GREEN GRASS.n.\\);.*" \
244 "next to next2"
245 } else {
246 gdb_test "next" ".*" ""
247 }
248
249 #call print_array_rep(\*list1, \*list2, \*list3)
250
251 if ![gdb_skip_stdio_test "print print_array_rep(...)"] {
252 gdb_test_stdio "print print_array_rep(\*list1, \*list2, \*list3)" \
253 "Contents of linked list3:"
254 }
255
256 set stop_line [gdb_get_line_number "-tbreak5-"]
257 gdb_test "tbreak $stop_line" \
258 "Temporary breakpoint..* file .*$srcfile, line $stop_line.*" \
259 "tbreakpoint at tbreak5"
260
261 gdb_test "continue" \
262 "main \\(\\) at .*$srcfile:$stop_line\r\n$stop_line\[\t \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*" \
263 "continue to tbreak5"
264
265
266 # Run into sum_array_print, and verify that the arguments were passed
267 # accurately.
268 #
269 # Note that we shouldn't use a `step' here to get into
270 # sum_array_print; GCC may emit calls to memcpy to put the arguments
271 # in the right place, and a step may end up in memcpy instead. This
272 # may itself be a bug, but it's not the one we're trying to catch
273 # here. I've added something to step-test.exp for this.
274 gdb_test "break sum_array_print" \
275 ".*Breakpoint ${decimal}: file .*$srcfile, line.*" \
276 "set breakpoint in sum_array_print"
277 gdb_test_no_output "set print frame-arguments all"
278 gdb_test "continue" \
279 ".*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 .*$srcfile:${decimal}\[ \t\n\r\]+${decimal}.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \
280 "check args of sum_array_print"
281
282 #call print_array_rep(linked_list1, linked_list2, linked_list3)
283 # this calls works from gdb without gdb_expect. But it does seem to hang
284 #from within gdb_expect.
285 #I comment this out
286 #send_gdb "print print_array_rep(linked_list1, linked_list2, linked_list3)\n"
287 #gdb_expect {
288 # -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 $" {
289 # pass "print print_array_rep(linked_list1, linked_list2, linked_list3)"
290 # }
291 # -re ".*$gdb_prompt $" { fail "print print_array_rep(linked_list1, linked_list2, linked_list3)" }
292 # timeout { fail "(timeout) print print_array_rep(linked_list1, linked_list2, linked_list3)" }
293 #}
294
295
296 set stop_line [gdb_get_line_number "-tbreak6-"]
297 gdb_test "tbreak $stop_line" \
298 "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
299 "tbreakpoint at tbreak6"
300
301 if ![gdb_skip_stdio_test "continuing to tbreak6"] {
302 gdb_test_stdio "continue" \
303 "Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t" \
304 "main \\(\\) at .*$srcfile:$stop_line.*c = 0.*" \
305 "continue to tbreak6"
306 } else {
307 gdb_test "continue" ".*" ""
308 }
309
310 #call print_small_structs(*struct1, *struct2, *struct3, *struct4,
311 # *flags, *flags_combo, *three_char, *five_char,
312 # *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
313
314 if {![gdb_skip_float_test "print print_small_structs(...)"] && \
315 ![gdb_skip_stdio_test "print print_small_structs(...)"] } {
316 gdb_test_stdio "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)" \
317 [multi_line \
318 "alpha" \
319 "gamma" \
320 "epsilon" \
321 "alpha" \
322 "gamma" \
323 "epsilon" \
324 "ch1: y\[ \t\]*ch2: n" \
325 "Contents of three_char_t: " \
326 "" \
327 "a\[ \t\]*b\[ \t\]*c" \
328 "Contents of five_char_t: " \
329 "" \
330 "l\[ \t\]*m\[ \t\]*n\[ \t\]*o\[ \t\]*p" \
331 "Contents of int_char_combo_t: " \
332 "" \
333 "123\[ \t\]*z" \
334 "Sum of the 4 struct values and seed : " \
335 "" \
336 "\[ \t\]*52" \
337 "Contents of struct1: " \
338 "" \
339 "\[ \t\]*6\[ \t\]*0" \
340 "Contents of struct2: " \
341 "" \
342 "\[ \t\]*10\[ \t\]*0" \
343 "Contents of struct3: " \
344 "" \
345 "\[ \t\]*12\[ \t\]*0" \
346 "Contents of one_double_t: " \
347 "" \
348 "10.500000" \
349 "Contents of one_double_t: " \
350 "" \
351 "-3.375000" \
352 "Contents of one_double_t: " \
353 "" \
354 "675.093750" \
355 "Contents of two_floats_t: " \
356 "" \
357 "\[ \t\]*45.234001\[ \t\]*43.599998" \
358 "Contents of two_floats_t: " \
359 "" \
360 "\[ \t\]*78.010002\[ \t\]*122.099998" \
361 "Contents of two_floats_t: " \
362 "" \
363 "-1232.344971\[ \t\]*-199.210007" \
364 ] \
365 "" \
366 "print print_small_structs"
367 }
368
369 #call compute_with_small_structs(20)
370 gdb_test "print compute_with_small_structs(20)" \
371 "\[0-9\]+ = void" \
372 "print compute_with_small_structs(20)"
373
374
375 #call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098,
376 # 3.14, -5678.12345, -0.11111111, 216.97065)
377
378 if {![gdb_skip_float_test "print print_ten_doubles(...)"] && \
379 ![gdb_skip_stdio_test "print print_ten_doubles(...)"]} {
380 gdb_test_stdio "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)" \
381 [multi_line \
382 "Two Doubles : 123.45\[0-9\]*.*123.45\[0-9\]*" \
383 "Two Doubles : -0.1200\[0-9\]*.*-1.2300\[0-9\]*" \
384 "Two Doubles : 343434.\[0-9\]*.*89.09\[0-9\]*" \
385 "Two Doubles : 3.1400\[0-9\]*.*-5678.123\[0-9\]*" \
386 "Two Doubles : -0.1111\[0-9\]*.*216.97\[0-9\]*" \
387 ]
388 }
389
390 set stop_line [gdb_get_line_number "-tbreak7-"]
391 gdb_test "tbreak $stop_line" \
392 "Temporary breakpoint .* file .*$srcfile, line $stop_line.*" \
393 "tbreakpoint at tbreak7"
394
395 gdb_test continue "Continuing\\..*main \\(.*\\) at.*$srcfile:$stop_line\[\t\r\n \]+$stop_line.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to tbreak7"
396
397 set stop_line [gdb_get_line_number "-step2-"]
398 if { [istarget "hppa*-*-hpux*"] } {
399 #
400 # NOTE:(FIXME)
401 # the aCC demangler cannot demangle the name of a function with >10 args.
402 # so I added a .* after the name of the function, to match the
403 # incredibly long mangled name
404 # (getting aCC's libdemangle.a bundled w/ the system?)
405 # DTS CLLbs16994 coulter 990114
406 #
407 # FIXME: use step for hppa* testing for now
408 # guo 990621
409 #
410 gdb_test "step" \
411 "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}:$stop_line\[\r\n\]+$stop_line\[ \t\]+printf\\(\"double :.*\", a\\);" \
412 "step into print_long_arg_list"
413 } else {
414
415 # We can't just assume that a "step" will get us into
416 # print_long_arg_list here,either.
417 gdb_test "tbreak print_long_arg_list" \
418 "Temporary breakpoint .* file .*$srcfile, line .*" \
419 "tbreak in print_long_arg_list after stepping into memcpy"
420 # The short match case below handles cases where a buffer
421 # overflows or something, and expect can't deal with the full
422 # line. Perhaps a more elegant solution exists... -sts 1999-08-17
423 if {![gdb_skip_float_test "step into print_long_arg_list"]} {
424 gdb_test_multiple "continue" "step into print_long_arg_list" {
425 -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}:$stop_line\[\r\n\]+$stop_line\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {
426 pass "step into print_long_arg_list"
427 }
428 -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}:$stop_line\[\r\n\]+$stop_line\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {
429 pass "step into print_long_arg_list (short match)"
430 }
431 }
432 } else {
433 # If skipping float tests, don't expect anything in arg list.
434 gdb_test "continue" \
435 "print_long_arg_list \\(.*\\).*" \
436 "step into print_long_arg_list"
437 }
438 }
439
440 set ws "\[\n\r\t \]+"
441
442 #call print_small_structs(struct1, struct2, struct3, struct4, flags,
443 # flags_combo, three_char, five_char, int_char_combo,
444 # d1, d2, d3, f1, f2, f3)
445
446 if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \
447 ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } {
448
449 # On 32-bit SPARC, some of the args are passed by ref, others by
450 # value, and GDB gets confused and says "Invalid cast" because it
451 # thinks it has to cast the structure into a pointer to structure.
452 if { [test_debug_format "stabs"] } then {
453 setup_kfail "gdb/1539" "sparc-*-*"
454 }
455
456
457 gdb_test_stdio "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)" \
458 [multi_line \
459 "alpha" \
460 "gamma" \
461 "epsilon" \
462 "alpha" \
463 "gamma" \
464 "epsilon" \
465 "ch1: y\[ \t\]*ch2: n" \
466 "Contents of three_char_t: " \
467 "" \
468 "a\[ \t\]*b\[ \t\]*c" \
469 "Contents of five_char_t: " \
470 "" \
471 "l\[ \t\]*m\[ \t\]*n\[ \t\]*o\[ \t\]*p" \
472 "Contents of int_char_combo_t: " \
473 "" \
474 "123\[ \t\]*z" \
475 "Sum of the 4 struct values and seed : " \
476 "" \
477 "\[ \t\]*52" \
478 "Contents of struct1: " \
479 "" \
480 "\[ \t\]*6\[ \t\]*0" \
481 "Contents of struct2: " \
482 "" \
483 "\[ \t\]*10\[ \t\]*0" \
484 "Contents of struct3: " \
485 "" \
486 "\[ \t\]*12\[ \t\]*0" \
487 "Contents of one_double_t: " \
488 "" \
489 "10.500000" \
490 "Contents of one_double_t: " \
491 "" \
492 "-3.375000" \
493 "Contents of one_double_t: " \
494 "" \
495 "675.093750" \
496 "Contents of two_floats_t: " \
497 "" \
498 "\[ \t\]*45.234001\[ \t\]*43.599998" \
499 "Contents of two_floats_t: " \
500 "" \
501 "\[ \t\]*78.010002\[ \t\]*122.099998" \
502 "Contents of two_floats_t: " \
503 "" \
504 "-1232.344971\[ \t\]*-199.210007" \
505 ] \
506 "" \
507 "print print_small_structs from print_long_arg_list"
508 }
509
510 set stop_line [gdb_get_line_number "-tbreak8-"]
511 gdb_test "tbreak $stop_line" \
512 "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
513 "tbreakpoint at tbreak8"
514
515 if ![gdb_skip_stdio_test "continuing to tbreak8"] {
516 gdb_test_stdio "continue" \
517 "Contents of two_floats_t:" \
518 ".*main \\(\\) at.*$srcfile:$stop_line.*$stop_line.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
519 "continue to tbreak8"
520 } else {
521 gdb_test "continue" ".*" ""
522 }
523
524 #step
525 set stop_line [gdb_get_line_number "-step3-"]
526 gdb_test "step" \
527 "init_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 .*$srcfile:$stop_line\[ \t\n\r\]+$stop_line.*bit_flags_combo->alpha = a;.*" \
528 "step into init_bit_flags_combo"
529
530 #call print_bit_flags_combo(*bit_flags_combo)
531 if ![gdb_skip_stdio_test "continuing at step3"] {
532 gdb_test_stdio "print print_bit_flags_combo(*bit_flags_combo)" \
533 "alpha.*gamma.*epsilon.*ch1: y.*ch2: n"
534 }
535
536
537 set stop_line [gdb_get_line_number "-tbreak9-"]
538 gdb_test "tbreak $stop_line" \
539 "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
540 "tbreakpoint at tbreak9"
541
542 gdb_test continue "Continuing\\..*main \\(\\) at .*$srcfile:$stop_line\[\r\n\t \]+$stop_line.*init_int_char_combo\\(int_char_combo, 13, .!.\\);.*" \
543 "continue to tbreak9"
544
545 #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)
546
547 # FIXME:
548 # HP aCC demangler currently does not handle hp aCC functions with >10 args
549 # DTS CLLbs16994 coulter 990114
550
551 if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*" CLLbs16994}
552
553 if {![gdb_skip_float_test "print print_long_arg_list"] && \
554 ![gdb_skip_stdio_test "print print_long_arg_list"] } {
555
556 gdb_test_stdio "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)" \
557 [multi_line \
558 "double : 22.250000" \
559 "double : 33.375000" \
560 "int : 0" \
561 "int : -25" \
562 "int : 100" \
563 "int : 2345" \
564 "alpha" \
565 "gamma" \
566 "epsilon" \
567 "alpha" \
568 "gamma" \
569 "epsilon" \
570 "ch1: y\[ \t\]*ch2: n" \
571 "Contents of three_char_t: " \
572 "" \
573 "x\[ \t\]*y\[ \t\]*z" \
574 "Contents of five_char_t: " \
575 "" \
576 "h\[ \t\]*e\[ \t\]*l\[ \t\]*l\[ \t\]*o" \
577 "Contents of int_char_combo_t: " \
578 "" \
579 "123\[ \t\]*z" \
580 "Sum of the 4 struct values and seed : " \
581 "" \
582 "\[ \t\]*52" \
583 "Contents of struct1: " \
584 "" \
585 "\[ \t\]*6\[ \t\]*0" \
586 "Contents of struct2: " \
587 "" \
588 "\[ \t\]*10\[ \t\]*0" \
589 "Contents of struct3: " \
590 "" \
591 "\[ \t\]*12\[ \t\]*0" \
592 "Contents of one_double_t: " \
593 "" \
594 "1.111110" \
595 "Contents of one_double_t: " \
596 "" \
597 "-345.340000" \
598 "Contents of one_double_t: " \
599 "" \
600 "546464.200000" \
601 "Contents of two_floats_t: " \
602 "" \
603 "0.234000\[ \t\]*453.100006" \
604 "Contents of two_floats_t: " \
605 "" \
606 "78.345001\[ \t\]*23.090000" \
607 "Contents of two_floats_t: " \
608 "" \
609 "-2.345000\[ \t\]*1.000000" \
610 ] \
611 "" \
612 "print print_long_arg_list"
613 }
614
615
616 set stop_line [gdb_get_line_number "-tbreak10-"]
617 gdb_test "tbreak $stop_line" \
618 "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
619 "tbreakpoint at tbreak10"
620
621 gdb_test continue "Continuing\\..*main \\(\\) at .*$srcfile:$stop_line\[ \t\n\r\]+$stop_line.*compute_with_small_structs\\(35\\);.*" \
622 "continue to tbreak10"
623
624
625 #call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
626 if ![gdb_skip_stdio_test "print sum_struct_print(...)"] {
627 gdb_test_stdio "print sum_struct_print(10,*struct1,*struct2,*struct3,*struct4)" \
628 "Sum of the 4 struct values and seed :\[ \t\n\r\]+218"
629 }
630
631
632 #call print_struct_rep(*struct1, *struct2, *struct3)
633 if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
634 gdb_test_stdio "print print_struct_rep(*struct1, *struct2, *struct3)" \
635 [multi_line \
636 "Contents of struct1: " \
637 "" \
638 " 22 0" \
639 "Contents of struct2: " \
640 "" \
641 " 42 0" \
642 "Contents of struct3: " \
643 "" \
644 " 62 0" \
645 ]
646 }
647
648 if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
649 gdb_test_stdio "print print_one_large_struct(*list1)" \
650 " 4 1"
651 }
652
653 set timeout $oldtimeout
654 return
655
This page took 0.044194 seconds and 5 git commands to generate.