summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/call-ar-st.exp
blob: d8ed4fef7dd9ad54801dbf9064168f12ff385962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
#   Copyright (C) 1998
#   Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu

# This file was written by Elena Zannoni (ezannoni@cygnus.com)


if $tracelevel then {
        strace $tracelevel
}

set prms_id 0
set bug_id 0

set testfile "call-ar-st"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}


if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}


# Create and source the file that provides information about the compiler
# used to compile the test case.

if [get_compiler_info ${binfile}] {
    return -1;
}

# The a29k can't call functions, so don't even bother with this test.
if [target_info exists gdb,cannot_call_functions] {
    setup_xfail "*-*-*" 2416
    fail "This target can not call functions"
    continue
}

# Set the current language to C.  This counts as a test.  If it
# fails, then we skip the other tests.

proc set_lang_c {} {
    global gdb_prompt

    send_gdb "set language c\n"
    gdb_expect {
	-re ".*$gdb_prompt $" {}
	timeout { fail "set language c (timeout)" ; return 0; }
    }

    send_gdb "show language\n"
    gdb_expect {
	-re ".* source language is \"c\".*$gdb_prompt $" {
	    pass "set language to \"c\""
	    return 1
	}
	-re ".*$gdb_prompt $" {
	    fail "setting language to \"c\""
	    return 0
	}
	timeout {
	    fail "can't show language (timeout)"
	    return 0
	}
    }
}


source ${binfile}.ci


# Start with a fresh gdb.

gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"


if ![runto_main] then {
    perror "couldn't run to breakpoint"
    continue
}

#go -until 1007
gdb_test "tbreak 1007" \
    "Breakpoint \[0-9\]+.*file.*$srcfile, line 1007.*" \
    "tbreakpoint line 1007"

gdb_test continue \
"Continuing\\..*main \\(\\) at.*$srcfile:1007.*" \
"run until breakpoint set at a line"


#call print_double_array(double_array)
send_gdb "print print_double_array(double_array)\n"
gdb_expect {
    -re "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.417500  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\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" {
        pass "print print_double_array(double_array)"
      }
    -re ".*$gdb_prompt $" { fail "print print_double_array(double_array)" }
    timeout           { fail "(timeout) print print_double_array(double_array)" }
  }


#call print_char_array(char_array)
send_gdb "print print_char_array(char_array)\n"
gdb_expect {
    -re "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\]+.*\[ \t\r\n\]+.*$gdb_prompt $" {
        pass "print print_char_array(char_array)"
      }
    -re ".*$gdb_prompt $" { fail "print print_char_array(char_array)" }
    timeout           { fail "(timeout) print print_char_array(char_array)" }
  }



#go -until 1014
gdb_test "tbreak 1014" \
"Breakpoint.*file.*$srcfile, line 1014.*" \
"tbreakpoint line 1014"

send_gdb "continue\n"
gdb_expect {
    -re "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\]+\[ \t\r\n\]+main.*at.*$srcfile:1014\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" {
        pass "continue to 1014"
      }
    -re ".*$gdb_prompt $" { fail "continue to 1014" }
    timeout           { fail "(timeout) continue to 1014" }
}

# I am disabling this test, because it takes too long. I verified by
# hand that it works, feel free to check for yourself. 
#call print_all_arrays(integer_array, char_array, float_array, double_array)
#send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n"
#gdb_expect {
#    -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 $" {
#        pass "print print_all_arrays(integer_array, char_array, float_array, double_array)"
#   }
#    -re ".*$gdb_prompt $" { fail "print print_all_arrays(integer_array, char_array, float_array, double_array)" }
#    timeout           { fail "(timeout) print print_all_arrays(integer_array, char_array, float_array, double_array)" }
#  }

#set timeout $oldtimeout
#go -until 1018
gdb_test "tbreak 1018" \
    "Breakpoint.* file .*$srcfile, line 1018.*" \
    "tbreakpoint line 1018"

gdb_test continue \
"Continuing\\..*array_d :.*array_f :.*student id :\[\t \]+.*YELLOW.*array_i :.*main \\(\\) at .*call-ar-st.c:1018\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." \
"continuing to breakpoint 1018"

#step
    send_gdb "step\n"
    gdb_expect {
        -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:287\[ \t\r\n\]+287.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"}
        -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" }
        timeout { fail "step inside print_all_arrays (timeout)" }
    }


#step -over
    send_gdb "next\n"
    gdb_expect {
        -re "array_i :.*288.*print_char_array\\(array_c\\);.*$gdb_prompt $" {pass "next over print_int_array in print-all_arrays"}
        -re ".*$gdb_prompt $" { fail "next over print_int_array in print-all_arrays" }
        timeout { fail "next over print_int_array in print-all_arrays (timeout)" }
    }



#call print_double_array(array_d)
send_gdb "print print_double_array(array_d)\n"
gdb_expect {
    -re "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.417500  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\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" {
        pass "print print_double_array(array_d)"
      }
    -re ".*$gdb_prompt $" { fail "print print_double_array(array_d)" }
    timeout           { fail "(timeout) print print_double_array(array_d)" }
  }


#go -until 1034
gdb_test "tbreak 1034" \
"Breakpoint.* file .*$srcfile, line 1034.*" \
"tbreakpoint line 1034"

gdb_test continue "Continuing\\..*array_c.*array_f.*array_d.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1034.*printf\\(.BYE BYE FOR NOW.n.\\)." "continuing to 1034"


#call sum_array_print(10, *list1, *list2, *list3, *list4)
send_gdb "print sum_array_print(10, *list1, *list2, *list3, *list4)\n"
gdb_expect {
    -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 $" {
        pass "print sum_array_print(10, *list1, *list2, *list3, *list4)"
      }
    -re ".*$gdb_prompt $" { fail "print sum_array_print(10, *list1, *list2, *list3, *list4)" }
    timeout           { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
  }


#step -over
    send_gdb "next\n"
    gdb_expect {
        -re "BYE BYE FOR NOW\[ \t\r\n\]+1035\[ \t\r\n\]+printf\\(.VERY GREEN GRASS.n.\\);\[ \t\r\n\]+.*$gdb_prompt $" { pass "next to 1035"}
        -re ".*$gdb_prompt $" { fail "next to 1035" }
        timeout { fail "next to 1035(timeout)" }
    }

#call print_array_rep(\*list1, \*list2, \*list3)

send_gdb "print print_array_rep(\*list1, \*list2, \*list3)\n"
gdb_expect {
    -re ".*.*$gdb_prompt $" {
        pass "print print_array_rep(*list1, *list2, *list3)"
      }
    -re ".*$gdb_prompt $" { fail "print print_array_rep(*list1, *list2, *list3)" }
    timeout           { fail "(timeout) print print_array_rep(*list1, *list2, *list3)"# }
  }



#go -until 1039
gdb_test "tbreak 1039" \
    "Breakpoint..* file .*$srcfile, line 1039.*" \
    "tbreakpoint line 1039"

send_gdb  "continue\n"
gdb_expect {
 -re ".*main \\(\\) at .*call-ar-st.c:1039\r\n1039\t\[ \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" {
                   pass "continue to 1039"}
 -re ".*$gdb_prompt $" { fail "continue to 1039"}
 timeout           { fail "(timeout) continue to 1039"}
}



# Run into sum_array_print, and verify that the arguments were passed
# accurately.
#
# Note that we shouldn't use a `step' here to get into
# sum_array_print; GCC may emit calls to memcpy to put the arguments
# in the right place, and a step may end up in memcpy instead.  This
# may itself be a bug, but it's not the one we're trying to catch
# here.  I've added something to step-test.exp for this.
gdb_test "break sum_array_print" \
	".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \
	"set breakpoint in sum_array_print"
gdb_test "continue" \
	".*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:909\[ \t\n\r\]+909.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \
	"check args of sum_array_print"

#call print_array_rep(linked_list1, linked_list2, linked_list3)
# this calls works from gdb without gdb_expect. But it does seem to hang
#from within gdb_expect.
#I comment this out
#send_gdb "print print_array_rep(linked_list1, linked_list2, linked_list3)\n"
#gdb_expect {
#    -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 $" {
#        pass "print print_array_rep(linked_list1, linked_list2, linked_list3)"
#      }
#    -re ".*$gdb_prompt $" { fail "print print_array_rep(linked_list1, linked_list2, linked_list3)" }
#    timeout           { fail "(timeout) print print_array_rep(linked_list1, linked_list2, linked_list3)" }
#}


#go -until 1079
gdb_test "tbreak 1079" \
    "Breakpoint.* file .*call-ar-st.c, line 1079.*" \
    "tbreakpoint line 1079"

send_gdb "continue\n"
gdb_expect {
 -re  "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1079.*c = 0.*$gdb_prompt $" {
                 pass "continue to 1079"}
      -re ".*$gdb_prompt $" { fail "continue to 1079"}           
      timeout           { fail "(timeout) continue to 1079"}
}

#call print_small_structs(*struct1, *struct2, *struct3, *struct4,*flags, *flags_combo,
#*three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
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"
gdb_expect {
    -re ".*alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+ch1: y\tch2: n\[\t\r\n \]+Contents of three_char_t:\[\t\r\n \]+a\tb\tc\[\t\r\n \]+Contents of five_char_t:\[\t\r\n \]+l\tm\tn\to\tp\[\t\r\n \]+Contents of int_char_combo_t:\[\t\r\n \]+123.*z\[\t\r\n \]+Sum of the 4 struct values and seed :\[\t\r\n \]+52\[\t\r\n \]+Contents of struct1:\[\t\r\n \]+6.*0\[\t\r\n \]+Contents of struct2:\[\t\r\n \]+10.*0\[\t\r\n \]+Contents of struct3:\[\t\r\n \]+12.*0\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+10.500000\[\t\r\n \]+Contents of one_double_t:.*-3.340000\[\t\r\n \]+Contents of one_double_t:.*675.091230\[\t\r\n \]+Contents of two_floats_t:.*45.234001.*43.599998\[\t\r\n \]+Contents of two_floats_t:.*78.010002.*122.099998\[\t\r\n \]+Contents of two_floats_t:.*-1232.344971.*-199.210007\[\t\r\n \]+.*$gdb_prompt $" {
        pass "print print_small_structs"
      }
    -re ".*$gdb_prompt $" { fail "print print_small_structs" }
    timeout           { fail "(timeout) print_small_structs" }
  }


#call compute_with_small_structs(20)
send_gdb "print compute_with_small_structs(20)\n"
gdb_expect {
    -re ".*\[0-9\]+ =.*$gdb_prompt $" {
        pass "print compute_with_small_structs(20)"
      }
    -re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" }
    timeout           { fail "(timeout) compute_with_small_structs(20)" }
  }


#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)
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"
gdb_expect {
    -re ".*Two Doubles : 123.456000.*123.456000\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450\[\t\r\n \]+Two Doubles : -0.111111.*216.970650\[\t\r\n \]+.*$gdb_prompt $" {
        pass "print print_ten_doubles"
      }
    -re ".*$gdb_prompt $" { fail "print print_ten_doubles" }
    timeout           { fail "(timeout) print_ten_doubles" }
  }

#go -until 1084
gdb_test "tbreak 1084" \
    "Breakpoint .* file .*call-ar-st.c, line 1084.*" \
    "tbreakpoint line 1084"

gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1084\[\t\r\n \]+1084.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1084"

  
    send_gdb "step\n"
    gdb_expect {
        -re ".*print_long_arg_list \\(a=22.219999999999999, b=33.332999999999998, 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.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:813\[\r\n\]+813\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"}
        -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
        timeout { fail "step into print_long_arg_list (timeout)" }
    }


#call print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)
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"
gdb_expect {
    -re ".*alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+ch1: y\tch2: n\[\t\r\n \]+Contents of three_char_t:\[\t\r\n \]+a\tb\tc\[\t\r\n \]+Contents of five_char_t:\[\t\r\n \]+l\tm\tn\to\tp\[\t\r\n \]+Contents of int_char_combo_t:\[\t\r\n \]+123.*z\[\t\r\n \]+Sum of the 4 struct values and seed :\[\t\r\n \]+52\[\t\r\n \]+Contents of struct1:\[\t\r\n \]+6.*0\[\t\r\n \]+Contents of struct2:\[\t\r\n \]+10.*0\[\t\r\n \]+Contents of struct3:\[\t\r\n \]+12.*0\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+10.500000\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+-3.340000\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+675.091230\[\t\r\n \]+Contents of two_floats_t:\[\t\r\n \]+45.234001.*43.599998\[\t\r\n \]+Contents of two_floats_t:\[\t\r\n \]+78.010002.*122.099998\[\t\r\n \]+Contents of two_floats_t:\[\t\r\n \]+-1232.344971.*-199.210007\[\t\r\n \]+.*$gdb_prompt $" {
        pass "print print_small_structs from print_long_arg_list "
      }
    -re ".*$gdb_prompt $" { fail "print print_small_structs from print_long_arg_list" }
    timeout           { fail "(timeout) print_small_structs from print_long_arg_list" }
  }



#go -until 1098
gdb_test "tbreak 1098" \
    "Breakpoint.* file .*call-ar-st.c, line 1098.*" \
    "tbreakpoint line 1098"

gdb_test continue "Continuing\\..*Contents of two_floats_t:.*-1232.344971.*-199.210007.*main \\(\\) at.*call-ar-st.c:1098.*1098.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
"continue to 1098"


#step
    send_gdb "step\n"
    gdb_expect {
        -re "
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 .*call-ar-st.c:385\[ \t\n\r\]+385.*bit_flags_combo->alpha = a;.*$gdb_prompt $" {
                            pass "step into init_bit_flags_combo"}
        -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" }
        timeout { fail "step into init_bit_flags_combo (timeout)" }
    }

#call print_bit_flags_combo(*bit_flags_combo)
send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
gdb_expect {
    -re ".*alpha.*gamma.*epsilon.*ch1: y\tch2: n.*$gdb_prompt $" {
        pass "print print_bit_flags_combo from init_bit_flags_combo"
      }
    -re ".*$gdb_prompt $" { fail "print print_bit_flags_combo from init_bit_flags_combo" }
    timeout           { fail "(timeout) print_bit_flags_combo from init_bit_flags_combo" }
  }


#go -until 1103
gdb_test "tbreak 1103" \
    "Breakpoint.* file .*call-ar-st.c, line 1103.*" \
    "tbreakpoint line 1103"

gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1103\[\r\n\t \]+1103.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \
"continue to 1103"

#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)
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"
gdb_expect {
    -re ".*double : 22.220000.*double : 33.333000.*int : 0.*int : -25.*int : 100.*int : 2345.*alpha.*gamma.*epsilon.*ch1: y\tch2: n.*Contents of three_char_t:.*x\ty\tz.*Contents of five_char_t:.*h\te\tl\tl\to.*Contents of int_char_combo_t:.*123\tz.*Sum of the 4 struct values and seed :.*52.*Contents of struct1:.*6\[ \]+0.*Contents of struct2:.*10\[ \]+0.*Contents of struct3:.*12.*0.*Contents of one_double_t:\[ \n\r\t\]+1.111110\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+-345.340000\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+546464.200000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+0.234000\t453.100006\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+78.345001\t23.090000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+-2.345000\t1.000000.*$gdb_prompt $" {
        pass "print print_long_arg_list"
      }
    -re ".*$gdb_prompt $" { fail "print print_long_arg_list" }
    timeout           { fail "(timeout) print_long_arg_list" }
  }


#go -until 1109
gdb_test "tbreak 1109" \
    "Breakpoint.* file .*call-ar-st.c, line 1109.*" \
    "tbreakpoint line 1109"

gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1109\[ \t\n\r\]+1109.*compute_with_small_structs\\(35\\);" \
"continue to 1109"


#call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n"
gdb_expect {
    -re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" {
        pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
      }
    -re ".*$gdb_prompt $" { fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" }
    timeout           { fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" }
  }


#call print_struct_rep(*struct1, *struct2, *struct3)
send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n"
gdb_expect {
    -re ".*Contents of struct1:\[ \t\n\r\]+        22         0\[ \t\n\r\]+Contents of struct2:\[ \t\n\r\]+        42         0\[ \t\n\r\]+Contents of struct3:\[ \t\n\r\]+        62         0\[ \t\n\r\]+.*$gdb_prompt $" {
        pass "print print_struct_rep(*struct1, *struct2, *struct3)"
      }
    -re ".*$gdb_prompt $" { fail "print print_struct_rep(*struct1, *struct2, *struct3)" }
    timeout           { fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" }
  }

send_gdb "print print_one_large_struct(*list1)\n"
gdb_expect {
    -re ".*         4         1.*$gdb_prompt $" {
        pass "print print_one_large_struct(*list1)"
      }
    -re ".*$gdb_prompt $" { fail "print print_one_large_struct(*list1)" }
    timeout           { fail "(timeout) print_one_large_struct(*list1)" }
  }

return

~