1 # Copyright 2005, 2006, 2007 Free Software Foundation, Inc.
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.
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.
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,
24 if { [skip_ada_tests] } { return -1 }
26 set testdir "array_return"
27 set testfile "${testdir}/p"
28 set srcfile ${srcdir}/${subdir}/${testfile}.adb
29 set binfile ${objdir}/${subdir}/${testfile}
31 file mkdir ${objdir}/${subdir}/${testdir}
32 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
38 gdb_reinitialize_dir $srcdir/$subdir
43 if ![runto_main] then {
44 fail "Cannot run to main, testcase aborted"
48 # Create a breakpoint in each function from which we want to test
49 # the "finish" command.
51 gdb_test "break create_small" \
52 "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
53 "insert breakpoint in create_small"
55 gdb_test "break create_large" \
56 "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
57 "insert breakpoint in create_large"
59 gdb_test "break create_small_float_vector" \
60 "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
61 "insert breakpoint in create_small_float_vector"
63 # Then continue until reaching the first breakpoint inside Create_Small,
64 # and then do a "finish".
67 "Breakpoint \[0-9\]+, pck.create_small \\(\\).*" \
68 "Continuing to Create_Small"
71 "Value returned is \\\$\[0-9\]+ = \\(1, 1\\)" \
72 "value printed by finish of Create_Small"
74 # Now continue until reaching the second breakpoint inside Create_Large,
75 # and then do another "finish".
78 "Breakpoint \[0-9\]+, pck.create_large \\(\\).*" \
79 "Continuing to Create_Large"
81 # On hppa32, the value returned is too large to be returned via a register.
82 # Instead, it is returned using the struct convention, and the debugger
83 # unfortunately cannot find the address of the result. The following
84 # test is therefore expected to fail for all hppa targets except hppa64.
85 if { ! [istarget "hppa*64*-*-*"] } then {
86 setup_xfail "hppa*-*-*"
90 "Value returned is \\\$\[0-9\]+ = \\(2, 2, 2, 2\\)" \
91 "value printed by finish of Create_Large"
93 # Now continue until reaching the third breakpoint, and then do another
97 "Breakpoint \[0-9\]+, pck.create_small_float_vector \\(\\).*" \
98 "Continuing to Create_Small_Float_Vector"
101 "Value returned is \\\$\[0-9\]+ = \\(4.25, 4.25\\)" \
102 "value printed by finish of Create_Small_Float_Vector"