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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [testsuite/] [gdb.base/] [call-ar-st.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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