1 # Copyright 2020 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 if {![is_aarch64_target]} {
22 verbose "Skipping ${gdb_test_file_name}."
27 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
32 untested "could not run to main"
36 # Number of expected SIGTRAP's to get. This needs to be kept in sync
37 # with the source file.
42 # Make sure we have a lower timeout in case GDB doesn't support a particular
43 # instruction. Such instruction will cause GDB to loop infinitely.
45 # Continue to next program breakpoint instruction.
46 gdb_test_multiple "continue" "brk instruction $count causes SIGTRAP" {
47 -re "Program received signal SIGTRAP, Trace/breakpoint trap.*$gdb_prompt $" {
50 # Insert a breakpoint at the program breakpoint instruction so
51 # GDB can step over it.
53 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
54 "insert breakpoint at brk instruction $count"
57 # We've reached the end of the test.
58 -re "exited normally.*$gdb_prompt $" {
68 # Verify we stopped at the expected number of SIGTRAP's.
69 gdb_assert {$count == $expected_traps} "all brk instructions triggered"