1 # Copyright 2008, 2009 Free Software Foundation, Inc.
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.
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.
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/>.
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"
26 gdb_reinitialize_dir $srcdir/$subdir
29 # We need to start the inferior to place the breakpoints in the memory at all.
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.
37 gdb_test "set breakpoint always-inserted on"
38 gdb_test "show breakpoint always-inserted" "Always inserted breakpoint mode is on."
40 set match "\nDump of assembler code for function main:\r\n(.*)End of assembler dump.\r\n$gdb_prompt $"
42 set test "disassembly without breakpoints"
43 gdb_test_multiple "disass main" $test {
45 set orig $expect_out(1,string)
50 gdb_test "b [gdb_get_line_number "break-first"]" "Breakpoint \[0-9\] at .*" "First breakpoint placed"
51 set test "Second breakpoint placed"
52 gdb_test_multiple "b [gdb_get_line_number "break-second"]" $test {
53 -re "Breakpoint \[0-9\] at (0x\[0-9a-f\]*):.*" {
55 set bpt2address $expect_out(1,string)
59 if [istarget "ia64-*-*"] then {
60 # Unoptimized code should not use the 3rd slot for the first instruction of
61 # a source line. This is important for our test, because we want both
62 # breakpoints ("Second breakpoint" and the following one) to be in the same
65 set test "Second breakpoint address is valid on ia64"
66 if [string match "*\[01\]" $bpt2address] {
69 gdb_test "b *($bpt2address + 1)" "Breakpoint \[0-9\] at .*" "Third breakpoint on ia64 in the Second breakpoint's bundle"
75 set test "disassembly with breakpoints"
76 gdb_test_multiple "disass main" $test {
78 set got $expect_out(1,string)
79 if [string equal -nocase $orig $got] {