]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/aarch64-brk-patterns.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-brk-patterns.exp
CommitLineData
3666a048 1# Copyright 2020-2021 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
21if {![is_aarch64_target]} {
22 verbose "Skipping ${gdb_test_file_name}."
23 return
24}
25
26standard_testfile
27if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
28 return -1
29}
30
31if {![runto_main]} {
32 untested "could not run to main"
33 return -1
34}
35
36# Number of expected SIGTRAP's to get. This needs to be kept in sync
37# with the source file.
38set expected_traps 3
39set keep_going 1
40set count 0
41
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.
44while {$keep_going} {
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 $" {
48 pass $gdb_test_name
49
50 # Insert a breakpoint at the program breakpoint instruction so
51 # GDB can step over it.
52 gdb_test "break" \
53 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
54 "insert breakpoint at brk instruction $count"
55 incr count
56 }
57 # We've reached the end of the test.
58 -re "exited normally.*$gdb_prompt $" {
59 set keep_going 0
60 }
61 timeout {
62 fail $gdb_test_name
63 set keep_going 0
64 }
65 }
66}
67
68# Verify we stopped at the expected number of SIGTRAP's.
69gdb_assert {$count == $expected_traps} "all brk instructions triggered"