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