]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/aarch64-brk-patterns.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-brk-patterns.exp
CommitLineData
1d506c26 1# Copyright 2020-2024 Free Software Foundation, Inc.
b62a8028
LM
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# This file is part of the gdb testsuite.
17
18# Test if GDB stops at various BRK instruction patterns inserted into
19# the code.
20
d9050fb8 21require is_aarch64_target
b62a8028
LM
22
23standard_testfile
24if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
25 return -1
26}
27
28if {![runto_main]} {
b62a8028
LM
29 return -1
30}
31
32# Number of expected SIGTRAP's to get. This needs to be kept in sync
33# with the source file.
34set expected_traps 3
35set keep_going 1
36set count 0
37
38# Make sure we have a lower timeout in case GDB doesn't support a particular
39# instruction. Such instruction will cause GDB to loop infinitely.
40while {$keep_going} {
41 # Continue to next program breakpoint instruction.
42 gdb_test_multiple "continue" "brk instruction $count causes SIGTRAP" {
43 -re "Program received signal SIGTRAP, Trace/breakpoint trap.*$gdb_prompt $" {
44 pass $gdb_test_name
45
46 # Insert a breakpoint at the program breakpoint instruction so
47 # GDB can step over it.
48 gdb_test "break" \
49 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
50 "insert breakpoint at brk instruction $count"
51 incr count
52 }
53 # We've reached the end of the test.
54 -re "exited normally.*$gdb_prompt $" {
55 set keep_going 0
56 }
57 timeout {
58 fail $gdb_test_name
59 set keep_going 0
60 }
61 }
62}
63
64# Verify we stopped at the expected number of SIGTRAP's.
65gdb_assert {$count == $expected_traps} "all brk instructions triggered"