1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2020-2023 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test that when setting breakpoints, setting a breakpoint on "foo"
19 # creates locations for all external and static functions called "foo"
20 # in the program, with and without debug info.
22 standard_testfile .c msym-bp-2.c
24 # Run "info breakpoints", and check that we find the two locations,
25 # LOC_A and LOC_B, in either order.
26 proc test_info_break_2 {loc_a loc_b} {
27 set re1 ".*\.1.*${loc_a}\r\n.*\.2.*${loc_b}"
28 set re2 ".*\.1.*${loc_b}\r\n.*\.2.*${loc_a}"
29 gdb_test "info breakpoint" "$re1|$re2"
33 global testfile srcfile srcfile2
42 if { [prepare_for_testing "failed to prepare" $testfile-$debug \
43 [list $srcfile $srcfile2] $options] } {
47 # Should find two locations: the static foo in the msym-bp.c file,
48 # and the extern foo in the msym-bp-2.c file. Same result
49 # expected before and after running to main.
50 proc test_break {prefix} {
54 with_test_prefix $prefix {
55 gdb_test "break foo" "\\(2 locations\\)"
59 "in foo at .*msym-bp.c:$decimal" \
60 "in foo at .*msym-bp-2.c:$decimal"
63 "<foo(\\+$decimal)?>" \
69 test_break "before run"
80 foreach_with_prefix debug {0 1} {