Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
fc9b693c JK |
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 | set testfile breakpoint-shadow | |
17 | set srcfile ${testfile}.c | |
18 | set binfile ${objdir}/${subdir}/${testfile} | |
19 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
20 | untested "Couldn't compile test program" | |
21 | return -1 | |
22 | } | |
23 | ||
24 | gdb_exit | |
25 | gdb_start | |
26 | gdb_reinitialize_dir $srcdir/$subdir | |
27 | gdb_load ${binfile} | |
28 | ||
29 | # We need to start the inferior to place the breakpoints in the memory at all. | |
30 | if ![runto_main] { | |
31 | untested start | |
32 | return -1 | |
33 | } | |
34 | ||
35 | # The default "auto" mode removes all the breakpoints when we stop (and not | |
36 | # running the nonstop mode). We would not be able to test the shadow. | |
27d3a1a2 | 37 | gdb_test_no_output "set breakpoint always-inserted on" |
fc9b693c JK |
38 | gdb_test "show breakpoint always-inserted" "Always inserted breakpoint mode is on." |
39 | ||
40 | set match "\nDump of assembler code for function main:\r\n(.*)End of assembler dump.\r\n$gdb_prompt $" | |
41 | ||
42 | set test "disassembly without breakpoints" | |
43 | gdb_test_multiple "disass main" $test { | |
44 | -re $match { | |
45 | set orig $expect_out(1,string) | |
46 | pass $test | |
47 | } | |
48 | } | |
49 | ||
50 | gdb_test "b [gdb_get_line_number "break-first"]" "Breakpoint \[0-9\] at .*" "First breakpoint placed" | |
8172766a | 51 | gdb_test "b [gdb_get_line_number "break-second"]" "Breakpoint \[0-9\] at .*" "Second breakpoint placed" |
fc9b693c JK |
52 | |
53 | set test "disassembly with breakpoints" | |
54 | gdb_test_multiple "disass main" $test { | |
55 | -re $match { | |
56 | set got $expect_out(1,string) | |
57 | if [string equal -nocase $orig $got] { | |
58 | pass $test | |
59 | } else { | |
60 | fail $test | |
61 | } | |
62 | } | |
63 | } |