Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.ada / array_return.exp
blob3bc5fba7a5067a6588e79d3d4d6a97e73894bb30
1 # Copyright 2005-2023 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 3 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, see <http://www.gnu.org/licenses/>.
16 load_lib "ada.exp"
18 if { [skip_ada_tests] } { return -1 }
20 standard_ada_testfile p
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
23     return -1
26 clean_restart ${testfile}
28 # Start the inferior
30 if {![runto_main]} {
31    return 0
34 # Create a breakpoint in each function from which we want to test
35 # the "finish" command.
37 gdb_test "break create_small" \
38          "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
39          "insert breakpoint in create_small"
41 gdb_test "break create_large" \
42          "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
43          "insert breakpoint in create_large"
45 gdb_test "break create_small_float_vector" \
46          "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \
47          "insert breakpoint in create_small_float_vector"
49 # Then continue until reaching the first breakpoint inside Create_Small,
50 # and then do a "finish".
52 gdb_test "cont" \
53          "Breakpoint \[0-9\]+, pck.create_small \\(\\).*" \
54          "continuing to Create_Small"
56 gdb_test "finish" \
57          "Value returned is \\\$\[0-9\]+ = \\(1, 1\\)" \
58          "value printed by finish of Create_Small"
60 # Now continue until reaching the second breakpoint inside Create_Large,
61 # and then do another "finish".
63 gdb_test "cont" \
64          "Breakpoint \[0-9\]+, pck.create_large \\(\\).*" \
65          "continuing to Create_Large"
67 # On hppa32, the value returned is too large to be returned via a register.
68 # Instead, it is returned using the struct convention, and the debugger
69 # unfortunately cannot find the address of the result.  The following
70 # test is therefore expected to fail for all hppa targets except hppa64.
71 if {![istarget "hppa*64*-*-*"]} {
72   setup_xfail "hppa*-*-*"
75 gdb_test "finish" \
76          "Value returned is \\\$\[0-9\]+ = \\(2, 2, 2, 2\\)" \
77          "value printed by finish of Create_Large"
79 # Now continue until reaching the third breakpoint, and then do another
80 # "finish" again.
82 gdb_test "cont" \
83          "Breakpoint \[0-9\]+, pck.create_small_float_vector \\(\\).*" \
84          "continuing to Create_Small_Float_Vector"
86 gdb_test "finish" \
87          "Value returned is \\\$\[0-9\]+ = \\(4.25, 4.25\\)" \
88          "value printed by finish of Create_Small_Float_Vector"