]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/powerpc-trap.exp
gas: drop remnants of ia64-*-aix*
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / powerpc-trap.exp
CommitLineData
1d506c26 1# Copyright 2021-2024 Free Software Foundation, Inc.
2bd64d21
JV
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 trap instructions inserted into
19# the code.
20
21if { [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.
25 set expected_traps 3
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.
30 set expected_traps 5
31} else {
e0a8643d 32 unsupported "Skipping powerpc-specific tests"
2bd64d21
JV
33 return
34}
35
36if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
37 return -1
38}
39
40if {![runto_main]} {
41 untested "could not run to main"
42 return -1
43}
44
45set keep_going 1
46set count 0
47
48while {$keep_going} {
49 set keep_going 0
50
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 $" {
54 pass $gdb_test_name
55
56 # Advance PC to next instruction
57 gdb_test "set \$pc = \$pc + 4" "" "advance past trap instruction $count"
58
59 incr count
60 if {$count < $expected_traps} {
61 set keep_going 1
62 }
63 }
64 }
65}
66
67# Verify we stopped at the expected number of SIGTRAP's.
68gdb_assert {$count == $expected_traps} "all trap instructions triggered"
69
70# One last continue to reach the end of the test, to make sure we don't get
71# another SIGTRAP.
72gdb_test "continue" "exited normally.*" "continue to end"