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