Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 2005, 2006, 2007, 2008, 2009, 2010 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 | |
16 | if $tracelevel then { | |
17 | strace $tracelevel | |
18 | } | |
19 | ||
20 | load_lib "ada.exp" | |
21 | ||
ec3c07fc NS |
22 | if { [skip_ada_tests] } { return -1 } |
23 | ||
1495de3f JB |
24 | set testdir "array_return" |
25 | set testfile "${testdir}/p" | |
26 | set srcfile ${srcdir}/${subdir}/${testfile}.adb | |
27 | set binfile ${objdir}/${subdir}/${testfile} | |
28 | ||
29 | file mkdir ${objdir}/${subdir}/${testdir} | |
ec3c07fc NS |
30 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { |
31 | return -1 | |
1495de3f JB |
32 | } |
33 | ||
34 | gdb_exit | |
35 | gdb_start | |
36 | gdb_reinitialize_dir $srcdir/$subdir | |
37 | gdb_load ${binfile} | |
38 | ||
39 | # Start the inferior | |
40 | ||
41 | if ![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 | ||
49 | gdb_test "break create_small" \ | |
50 | "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \ | |
51 | "insert breakpoint in create_small" | |
52 | ||
53 | gdb_test "break create_large" \ | |
54 | "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \ | |
55 | "insert breakpoint in create_large" | |
56 | ||
ba54f318 JB |
57 | gdb_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 | ||
64 | gdb_test "cont" \ | |
65 | "Breakpoint \[0-9\]+, pck.create_small \\(\\).*" \ | |
ba54f318 | 66 | "Continuing to Create_Small" |
1495de3f JB |
67 | |
68 | gdb_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 | ||
75 | gdb_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. | |
83 | if { ! [istarget "hppa*64*-*-*"] } then { | |
84 | setup_xfail "hppa*-*-*" | |
85 | } | |
86 | ||
1495de3f JB |
87 | gdb_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 | ||
94 | gdb_test "cont" \ | |
95 | "Breakpoint \[0-9\]+, pck.create_small_float_vector \\(\\).*" \ | |
96 | "Continuing to Create_Small_Float_Vector" | |
97 | ||
98 | gdb_test "finish" \ | |
99 | "Value returned is \\\$\[0-9\]+ = \\(4.25, 4.25\\)" \ | |
100 | "value printed by finish of Create_Small_Float_Vector" | |
101 |