Fix skip.exp test failure observed with gcc-9.2.0
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / asmlabel.exp
1 # Copyright (C) 2015-2019 Free Software Foundation, Inc.
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 # Test to see that GDB reports the correct function name when stopping
17 # in a function with several assembly-defined labels; see the test
18 # case asmlabel.c.
19 #
20 # When setting and then continuing to a breakpoint at either location
21 # L1 or L2 - again, see the code - we want to make sure that GDB
22 # correctly reports that it's in main, like this:
23 #
24 # Breakpoint 2, main (argc=1, argv=0x7fffffffe408) at asmlabel.c:26
25 # 26 v = 1; /* set L1 breakpoint here */
26 #
27 # This test case was written to test for a bug in which GDB printed
28 # the following instead:
29 #
30 # Breakpoint 2, L1 () at asmlabel.c:26
31 # 26 v = 1; /* set L1 breakpoint here */
32 #
33
34 standard_testfile
35
36 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
37 return -1
38 }
39
40 if ![runto_main] {
41 fail "can't run to main"
42 return 0
43 }
44
45 set L1_bploc [gdb_get_line_number "set L1 breakpoint here" $srcfile]
46 set L2_bploc [gdb_get_line_number "set L2 breakpoint here" $srcfile]
47
48 gdb_test "break $srcfile:$L1_bploc" \
49 "Breakpoint.*at.* file .*$srcfile, line $L1_bploc\\." \
50 "breakpoint at L1"
51
52 gdb_test "break $L2_bploc" \
53 "Breakpoint.*at.* file .*$srcfile, line $L2_bploc\\." \
54 "breakpoint at L2"
55
56 gdb_test "continue" \
57 "Continuing.*Breakpoint \[0-9\]+, main .* at .*$srcfile:$L1_bploc.*" \
58 "continue to L1"
59
60 gdb_test "continue" \
61 "Continuing.*Breakpoint \[0-9\]+, main .* at .*$srcfile:$L2_bploc.*" \
62 "continue to L2"
63
64 gdb_test "print v" "= 1" "check value of v at L2"
This page took 0.042712 seconds and 4 git commands to generate.