1 # Copyright 2021-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 trap instructions inserted into
21 if { [istarget powerpc-*] } {
22 standard_testfile powerpc-trap.s
23 # Number of expected SIGTRAPs to get. This needs to be kept in sync
24 # with the source file powerpc-trap.s.
26 } elseif {[istarget powerpc64*] } {
27 standard_testfile powerpc64-trap.s
28 # Number of expected SIGTRAPs to get. This needs to be kept in sync
29 # with the source file powerpc64-trap.s.
32 unsupported "Skipping powerpc-specific tests"
36 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
41 untested "could not run to main"
51 # Continue to next program breakpoint instruction.
52 gdb_test_multiple "continue" "trap instruction $count causes SIGTRAP" {
53 -re "Program received signal SIGTRAP, Trace/breakpoint trap.*$gdb_prompt $" {
56 # Advance PC to next instruction
57 gdb_test "set \$pc = \$pc + 4" "" "advance past trap instruction $count"
60 if {$count < $expected_traps} {
67 # Verify we stopped at the expected number of SIGTRAP's.
68 gdb_assert {$count == $expected_traps} "all trap instructions triggered"
70 # One last continue to reach the end of the test, to make sure we don't get
72 gdb_test "continue" "exited normally.*" "continue to end"