GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
[binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-brk-patterns.exp
blobd52df43d0586e28d0a515fef714902d51a488ce5
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
19 # the code.
21 require is_aarch64_target
23 standard_testfile
24 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
25 return -1
28 if {![runto_main]} {
29 return -1
32 # Number of expected SIGTRAP's to get. This needs to be kept in sync
33 # with the source file.
34 set expected_traps 3
35 set keep_going 1
36 set count 0
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.
40 while {$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
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
53 # We've reached the end of the test.
54 -re "exited normally.*$gdb_prompt $" {
55 set keep_going 0
57 timeout {
58 fail $gdb_test_name
59 set keep_going 0
64 # Verify we stopped at the expected number of SIGTRAP's.
65 gdb_assert {$count == $expected_traps} "all brk instructions triggered"