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