]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2022-2024 Free Software Foundation, Inc. |
6d263fe4 TT |
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 | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
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 | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | load_lib "ada.exp" | |
17 | ||
74dcf082 | 18 | require allow_ada_tests |
6d263fe4 TT |
19 | |
20 | standard_ada_testfile caller | |
21 | ||
22 | set options { | |
23 | debug | |
24 | optimize=-O2 | |
25 | additional_flags=-ffunction-sections | |
21f507ef TV |
26 | ldflags=-largs |
27 | ldflags=-Wl,--gc-sections | |
28 | ldflags=-margs | |
6d263fe4 TT |
29 | additional_flags=-gnatn |
30 | } | |
31 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != ""} { | |
32 | return -1 | |
33 | } | |
34 | ||
35 | clean_restart ${testfile} | |
36 | ||
284c40cb CL |
37 | |
38 | # Depending on the version of gnat, the location of the set breakpoint may | |
39 | # be reported as being at the requested location in file callee.adb or in | |
40 | # file caller.adb where the callee function was inlined. Either way, only | |
41 | # one breakpoint should be reported and its address should not be at 0x0. | |
42 | set bp_location1 [gdb_get_line_number "BREAK" ${testdir}/callee.adb] | |
43 | set bp_location2 [gdb_get_line_number "CALLEE_LOC" ${testdir}/caller.adb] | |
44 | set test "break callee.adb:$bp_location1" | |
45 | set message "Breakpoint set" | |
46 | ||
6d263fe4 TT |
47 | # The bug here was that gdb would set a breakpoint with two locations, |
48 | # one of them at 0x0. | |
284c40cb CL |
49 | gdb_test_multiple $test $message { |
50 | -re "Breakpoint $decimal at $hex: file .*callee.adb, line $bp_location1." { | |
51 | pass $test | |
52 | } | |
53 | -re "Breakpoint $decimal at $hex: file .*caller.adb, line $bp_location2." { | |
54 | pass $test | |
55 | } | |
56 | } |