]>
Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright 2005-2016 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 | 15 | |
1495de3f JB |
16 | load_lib "ada.exp" |
17 | ||
ec3c07fc NS |
18 | if { [skip_ada_tests] } { return -1 } |
19 | ||
8223e12c | 20 | standard_ada_testfile p |
1495de3f | 21 | |
ec3c07fc NS |
22 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { |
23 | return -1 | |
1495de3f JB |
24 | } |
25 | ||
09050809 | 26 | clean_restart ${testfile} |
1495de3f JB |
27 | |
28 | # Start the inferior | |
29 | ||
30 | if ![runto_main] then { | |
bc6c7af4 | 31 | fail "cannot run to main, testcase aborted" |
1495de3f JB |
32 | return 0 |
33 | } | |
34 | ||
35 | # Create a breakpoint in each function from which we want to test | |
36 | # the "finish" command. | |
37 | ||
38 | gdb_test "break create_small" \ | |
39 | "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \ | |
40 | "insert breakpoint in create_small" | |
41 | ||
42 | gdb_test "break create_large" \ | |
43 | "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \ | |
44 | "insert breakpoint in create_large" | |
45 | ||
ba54f318 JB |
46 | gdb_test "break create_small_float_vector" \ |
47 | "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \ | |
48 | "insert breakpoint in create_small_float_vector" | |
49 | ||
1495de3f JB |
50 | # Then continue until reaching the first breakpoint inside Create_Small, |
51 | # and then do a "finish". | |
52 | ||
53 | gdb_test "cont" \ | |
54 | "Breakpoint \[0-9\]+, pck.create_small \\(\\).*" \ | |
bb95117e | 55 | "continuing to Create_Small" |
1495de3f JB |
56 | |
57 | gdb_test "finish" \ | |
58 | "Value returned is \\\$\[0-9\]+ = \\(1, 1\\)" \ | |
59 | "value printed by finish of Create_Small" | |
60 | ||
61 | # Now continue until reaching the second breakpoint inside Create_Large, | |
62 | # and then do another "finish". | |
63 | ||
64 | gdb_test "cont" \ | |
65 | "Breakpoint \[0-9\]+, pck.create_large \\(\\).*" \ | |
bb95117e | 66 | "continuing to Create_Large" |
1495de3f | 67 | |
2db2d571 JB |
68 | # On hppa32, the value returned is too large to be returned via a register. |
69 | # Instead, it is returned using the struct convention, and the debugger | |
70 | # unfortunately cannot find the address of the result. The following | |
71 | # test is therefore expected to fail for all hppa targets except hppa64. | |
72 | if { ! [istarget "hppa*64*-*-*"] } then { | |
73 | setup_xfail "hppa*-*-*" | |
74 | } | |
75 | ||
1495de3f JB |
76 | gdb_test "finish" \ |
77 | "Value returned is \\\$\[0-9\]+ = \\(2, 2, 2, 2\\)" \ | |
78 | "value printed by finish of Create_Large" | |
79 | ||
ba54f318 JB |
80 | # Now continue until reaching the third breakpoint, and then do another |
81 | # "finish" again. | |
82 | ||
83 | gdb_test "cont" \ | |
84 | "Breakpoint \[0-9\]+, pck.create_small_float_vector \\(\\).*" \ | |
bb95117e | 85 | "continuing to Create_Small_Float_Vector" |
ba54f318 JB |
86 | |
87 | gdb_test "finish" \ | |
88 | "Value returned is \\\$\[0-9\]+ = \\(4.25, 4.25\\)" \ | |
89 | "value printed by finish of Create_Small_Float_Vector" | |
90 |