* gdb.ada/array_return.exp: Update copyright date list.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / array_return.exp
CommitLineData
cab8ac94 1# Copyright 2005, 2006 Free Software Foundation, Inc.
1495de3f
JB
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
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
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.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16# MA 02110-1301, USA
17
18if $tracelevel then {
19 strace $tracelevel
20}
21
22load_lib "ada.exp"
23
24set testdir "array_return"
25set testfile "${testdir}/p"
26set srcfile ${srcdir}/${subdir}/${testfile}.adb
27set binfile ${objdir}/${subdir}/${testfile}
28
29file mkdir ${objdir}/${subdir}/${testdir}
30if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
31 return -1
32}
33
34gdb_exit
35gdb_start
36gdb_reinitialize_dir $srcdir/$subdir
37gdb_load ${binfile}
38
39# Start the inferior
40
41if ![runto_main] then {
42 fail "Cannot run to main, testcase aborted"
43 return 0
44}
45
46# Create a breakpoint in each function from which we want to test
47# the "finish" command.
48
49gdb_test "break create_small" \
50 "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
51 "insert breakpoint in create_small"
52
53gdb_test "break create_large" \
54 "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
55 "insert breakpoint in create_large"
56
ba54f318
JB
57gdb_test "break create_small_float_vector" \
58 "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
59 "insert breakpoint in create_small_float_vector"
60
1495de3f
JB
61# Then continue until reaching the first breakpoint inside Create_Small,
62# and then do a "finish".
63
64gdb_test "cont" \
65 "Breakpoint \[0-9\]+, pck.create_small \\(\\).*" \
ba54f318 66 "Continuing to Create_Small"
1495de3f
JB
67
68gdb_test "finish" \
69 "Value returned is \\\$\[0-9\]+ = \\(1, 1\\)" \
70 "value printed by finish of Create_Small"
71
72# Now continue until reaching the second breakpoint inside Create_Large,
73# and then do another "finish".
74
75gdb_test "cont" \
76 "Breakpoint \[0-9\]+, pck.create_large \\(\\).*" \
ba54f318 77 "Continuing to Create_Large"
1495de3f 78
2db2d571
JB
79# On hppa32, the value returned is too large to be returned via a register.
80# Instead, it is returned using the struct convention, and the debugger
81# unfortunately cannot find the address of the result. The following
82# test is therefore expected to fail for all hppa targets except hppa64.
83if { ! [istarget "hppa*64*-*-*"] } then {
84 setup_xfail "hppa*-*-*"
85}
86
1495de3f
JB
87gdb_test "finish" \
88 "Value returned is \\\$\[0-9\]+ = \\(2, 2, 2, 2\\)" \
89 "value printed by finish of Create_Large"
90
ba54f318
JB
91# Now continue until reaching the third breakpoint, and then do another
92# "finish" again.
93
94gdb_test "cont" \
95 "Breakpoint \[0-9\]+, pck.create_small_float_vector \\(\\).*" \
96 "Continuing to Create_Small_Float_Vector"
97
98gdb_test "finish" \
99 "Value returned is \\\$\[0-9\]+ = \\(4.25, 4.25\\)" \
100 "value printed by finish of Create_Small_Float_Vector"
101
This page took 0.103589 seconds and 4 git commands to generate.