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