Skip to content

Commit 34360f0

Browse files
danglin44hdeller
authored andcommitted
parisc: improve ptrace support for gdb single-step
Various GCC tests use gdb to simulate a multithreaded application. Many of these tests have been failing on parisc linux. GCC does this by using gdb to single-step the application, then gdb is used to call other test specific code. Where this fails is when the application is stepped into the delay slot of a taken branch. This sets the PSW B bit. When the test specific code is executed, this usually clears the PSW B bit. Currently, gdb is not allowed to set the B bit. So, the code falls through what should be a taken branch. The attached patch adds the PSW B bit to the set of bits that gdb is allowed to set. In order to set the B bit, the trace system call must return using an interrupt restore. The patch also modifies this code to use the saved IAOQ values when they are saved by a ptrace syscall or interruption. Signed-off-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent cac1f12 commit 34360f0

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎arch/parisc/kernel/entry.S‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ syscall_restore:
18651865

18661866
/* Are we being ptraced? */
18671867
ldw TASK_FLAGS(%r1),%r19
1868-
ldi (_TIF_SINGLESTEP|_TIF_BLOCKSTEP),%r2
1868+
ldi _TIF_SYSCALL_TRACE_MASK,%r2
18691869
and,COND(=) %r19,%r2,%r0
18701870
b,n syscall_restore_rfi
18711871

@@ -1978,15 +1978,23 @@ syscall_restore_rfi:
19781978
/* sr2 should be set to zero for userspace syscalls */
19791979
STREG %r0,TASK_PT_SR2(%r1)
19801980

1981-
pt_regs_ok:
19821981
LDREG TASK_PT_GR31(%r1),%r2
1983-
depi 3,31,2,%r2 /* ensure return to user mode. */
1984-
STREG %r2,TASK_PT_IAOQ0(%r1)
1982+
depi 3,31,2,%r2 /* ensure return to user mode. */
1983+
STREG %r2,TASK_PT_IAOQ0(%r1)
19851984
ldo 4(%r2),%r2
19861985
STREG %r2,TASK_PT_IAOQ1(%r1)
1986+
b intr_restore
19871987
copy %r25,%r16
1988+
1989+
pt_regs_ok:
1990+
LDREG TASK_PT_IAOQ0(%r1),%r2
1991+
depi 3,31,2,%r2 /* ensure return to user mode. */
1992+
STREG %r2,TASK_PT_IAOQ0(%r1)
1993+
LDREG TASK_PT_IAOQ1(%r1),%r2
1994+
depi 3,31,2,%r2
1995+
STREG %r2,TASK_PT_IAOQ1(%r1)
19881996
b intr_restore
1989-
nop
1997+
copy %r25,%r16
19901998

19911999
.import schedule,code
19922000
syscall_do_resched:

‎arch/parisc/kernel/ptrace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <asm/asm-offsets.h>
2727

2828
/* PSW bits we allow the debugger to modify */
29-
#define USER_PSW_BITS (PSW_N | PSW_V | PSW_CB)
29+
#define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB)
3030

3131
/*
3232
* Called by kernel/ptrace.c when detaching..

0 commit comments

Comments
 (0)