Fix gdb.base/sigstep.exp test for ppc

The test stops at <signal_handler called> which is the call to the handler
rather than in the handler as intended.  This patch replaces the
gdb_test "$enter_cmd to handler" with a gdb_test_multiple test.  The multiple
test looks for the stop at <signal_handler called>.  If found, the command
is issued again.  The test passes if gdb stops in the handler as expected.

(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step
from handler: continue to signal
stepi
<signal handler called>
1: x/i $pc
=> 0x7ffff7f80440 <__kernel_start_sigtramp_rt64>:       bctrl
(gdb) stepi
handler (sig=551) at sigstep.c:32
32      {
1: x/i $pc
=> 0x10000097c <handler>:       addis   r2,r12,2
(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler,
step from handler: stepi to handler

Patch has been tested on x86_64-linux and ppc64le-linux with no test failures.
This commit is contained in:
Carl Love
2021-11-05 20:25:28 +00:00
parent 1f28b70def
commit b626a80342

View File

@ -79,6 +79,7 @@ validate_backtrace
proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } {
global gdb_prompt inferior_exited_re
global clear_done other_handler_location
global decimal
set prefix "$enter_cmd to handler, $in_handler_prefix in handler, $exit_cmd from handler"
@ -93,7 +94,16 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } {
gdb_test "handle SIGVTALRM print pass stop"
gdb_test "continue" "Program received signal.*" "continue to signal"
}
gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler"
gdb_test_multiple "$enter_cmd" "$enter_cmd to handler" {
-re -wrap "\r\n<signal handler called>.*" {
send_gdb "$enter_cmd\n"
exp_continue
}
-re -wrap "\r\n(Breakpoint $decimal, )?handler \\(sig=.*" {
pass $gdb_test_name
}
}
delete_breakpoints