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