OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [call-ar-st.exp] - Blame information for rev 833

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.