1 # Copyright 2020-2024 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 # This file is part of the gdb testsuite.
18 # Test if GDB stops at various BRK instruction patterns inserted into
21 require is_aarch64_target
24 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
32 # Number of expected SIGTRAP's to get. This needs to be kept in sync
33 # with the source file.
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.
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 $" {
46 # Insert a breakpoint at the program breakpoint instruction so
47 # GDB can step over it.
49 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
50 "insert breakpoint at brk instruction $count"
53 # We've reached the end of the test.
54 -re "exited normally.*$gdb_prompt $" {
64 # Verify we stopped at the expected number of SIGTRAP's.
65 gdb_assert {$count == $expected_traps} "all brk instructions triggered"