PR gdb/15827
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / breakpoint-shadow.exp
CommitLineData
ecd75fc8 1# Copyright 2008-2014 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
a64d2530
TT
16standard_testfile
17
18if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
19 untested $testfile.exp
fc9b693c
JK
20 return -1
21}
22
fc9b693c
JK
23# We need to start the inferior to place the breakpoints in the memory at all.
24if ![runto_main] {
25 untested start
26 return -1
27}
28
29# The default "auto" mode removes all the breakpoints when we stop (and not
30# running the nonstop mode). We would not be able to test the shadow.
27d3a1a2 31gdb_test_no_output "set breakpoint always-inserted on"
fc9b693c
JK
32gdb_test "show breakpoint always-inserted" "Always inserted breakpoint mode is on."
33
34set match "\nDump of assembler code for function main:\r\n(.*)End of assembler dump.\r\n$gdb_prompt $"
35
36set test "disassembly without breakpoints"
37gdb_test_multiple "disass main" $test {
38 -re $match {
39 set orig $expect_out(1,string)
40 pass $test
41 }
42}
43
44gdb_test "b [gdb_get_line_number "break-first"]" "Breakpoint \[0-9\] at .*" "First breakpoint placed"
8172766a 45gdb_test "b [gdb_get_line_number "break-second"]" "Breakpoint \[0-9\] at .*" "Second breakpoint placed"
fc9b693c 46
0f26cec1
PA
47# Disassemble main, and compare the output to the original output
48# before breakpoints were inserted. TEST is used as test message.
49
50proc test_disassembly {test} {
51 global match orig
52
53 gdb_test_multiple "disass main" $test {
54 -re $match {
55 set got $expect_out(1,string)
56 if [string equal -nocase $orig $got] {
57 pass $test
58 } else {
59 fail $test
60 }
fc9b693c
JK
61 }
62 }
63}
0f26cec1
PA
64
65test_disassembly "disassembly with breakpoints"
66
67# Now check the interaction between the code cache and breakpoint
68# always-inserted mode.
69
70# Recreate the code cache when breakpoints are already inserted.
71gdb_test_no_output "set code-cache off"
72gdb_test_no_output "set code-cache on"
73
74test_disassembly "disassembly with breakpoints, fresh code cache"
75
76# Delete breakpoints. This should update the code cache as well.
77delete_breakpoints
78
79test_disassembly "disassembly without breakpoints, no stale breakpoints"
This page took 0.614413 seconds and 4 git commands to generate.