]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
3722707be6e0a93e714f530dd4ec683ef9d05d3d
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / ia64-breakpoint-shadow.exp
1 # Copyright 2009-2017 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 if ![istarget "ia64-*-*"] {
17 verbose "Skipping ia64-breakpoint-shadow test."
18 return
19 }
20
21 set testfile ia64-breakpoint-shadow
22 set srcfile ${testfile}.S
23 set binfile ${objdir}/${subdir}/${testfile}
24 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
25 untested "failed to compile"
26 return -1
27 }
28
29 gdb_exit
30 gdb_start
31 gdb_reinitialize_dir $srcdir/$subdir
32 gdb_load ${binfile}
33
34 # We need to start the inferior to place the breakpoints in the memory at all.
35 if ![runto_main] {
36 untested start
37 return -1
38 }
39
40 # The default "auto" mode removes all the breakpoints when we stop (and not
41 # running the nonstop mode). We would not be able to test the shadow.
42 gdb_test "set breakpoint always-inserted on"
43 gdb_test "show breakpoint always-inserted" "Always inserted breakpoint mode is on."
44
45 set match "\nDump of assembler code for function main:\r\n(.*)End of assembler dump.\r\n$gdb_prompt $"
46
47 set test "disassembly without breakpoints"
48 gdb_test_multiple "disass main" $test {
49 -re $match {
50 set orig $expect_out(1,string)
51 pass $test
52 }
53 }
54
55 set test "slot 0 breakpoint placed"
56 gdb_test_multiple "b bundle" $test {
57 -re "Breakpoint \[0-9\] at (0x\[0-9a-f\]*0):.*$gdb_prompt $" {
58 pass $test
59 set bpt2address $expect_out(1,string)
60 }
61 }
62
63 if ![info exists bpt2address] {
64 return -1
65 }
66
67 gdb_test "b *($bpt2address + 1)" "Breakpoint \[0-9\] at .*" "slot 1 breakpoint placed"
68 gdb_test "b *($bpt2address + 2)" "Can't insert breakpoint for non-existing slot X" "slot 2 (slot X) breakpoint refusal"
69
70 set test "disassembly with breakpoints"
71 gdb_test_multiple "disass main" $test {
72 -re $match {
73 set got $expect_out(1,string)
74 if [string equal -nocase $orig $got] {
75 pass $test
76 } else {
77 fail $test
78 }
79 }
80 }