1 # Copyright (C) 2011-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/>.
18 require can_single_step_to_signal_handler
20 require {!target_info exists gdb,nosignals}
22 if [prepare_for_testing "failed to prepare" ${testfile}] {
26 gdb_test "handle SIGUSR1 stop print pass" "SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+.*"
32 gdb_test "continue" "Program received signal SIGUSR1, .*"
35 gdb_test_multiple "stepi" $test {
36 -re -wrap "\r\nhandler .*" {
39 -re "signal handler called.*$gdb_prompt $" {
40 # After PowerPC Linux kernel commit:
42 # commit: 0138ba5783ae0dcc799ad401a1e8ac8333790df9
43 # powerpc/64/signal: Balance return predictor
44 # stack in signal trampoline.
46 # The kernel places an additional brctl instruction
47 # in the vdso to call the user handler.
49 # And then this commit:
51 # commit 24321ac668e452a4942598533d267805f291fdc9
52 # powerpc/64/signal: Fix regression in
53 # __kernel_sigtramp_rt64() semantics
55 # updates the semantics of __kernel_sigtramp_rt64().
56 # It added a new symbol to serve as a jump target from
57 # the kernel to the trampoline.
59 # The net result of these changes is that gdb stops
60 # at __kernel_start_sigtramp_rt64. Need to do one
61 # more stepi to reach the expected location in the user
63 gdb_test "p \$pc" ".*__kernel_start_sigtramp_rt64.*" "in kernel code"
64 gdb_test "stepi" "\r\nhandler .*" $test
68 gdb_test_multiple "kill" "kill" {
69 -re "Kill the program being debugged\\? \\(y or n\\) $" {
70 gdb_test "y" "\\\[Inferior $decimal \\(.*\\) killed\\\]" "kill"