Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.base / msym-bp.exp
blobe39f6fc26f6acecd2226b2d1aae28dab8fca7d80
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"
32 proc test {debug} {
33     global testfile srcfile srcfile2
34     global decimal
36     if {$debug} {
37         set options "debug"
38     } else {
39         set options ""
40     }
42     if { [prepare_for_testing "failed to prepare" $testfile-$debug \
43               [list $srcfile $srcfile2] $options] } {
44         return -1
45     }
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} {
51         global decimal
52         upvar debug debug
54         with_test_prefix $prefix {
55             gdb_test "break foo" "\\(2 locations\\)"
57             if {$debug} {
58                 test_info_break_2 \
59                     "in foo at .*msym-bp.c:$decimal" \
60                     "in foo at .*msym-bp-2.c:$decimal"
61             } else {
62                 test_info_break_2 \
63                     "<foo(\\+$decimal)?>" \
64                     "<foo(\\+$decimal)?>"
65             }
66         }
67     }
69     test_break "before run"
71     if ![runto_main] {
72         return
73     }
75     delete_breakpoints
77     test_break "at main"
80 foreach_with_prefix debug {0 1} {
81     test $debug