diff options
| author | John David Anglin <dave.anglin@bell.net> | 2012-12-28 18:18:01 -0500 |
|---|---|---|
| committer | Helge Deller <deller@gmx.de> | 2013-01-07 17:06:27 -0500 |
| commit | 34360f080cb5848990576e1465d2d01a3c261762 (patch) | |
| tree | 42103381d3b28801443b609a1f0bc9bf0001eaf7 | |
| parent | cac1f12b9f7409510a5abcf3eaecc2c56b75242a (diff) | |
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>
| -rw-r--r-- | arch/parisc/kernel/entry.S | 18 | ||||
| -rw-r--r-- | arch/parisc/kernel/ptrace.c | 2 |
2 files changed, 14 insertions, 6 deletions
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index bfb44247d7a7..eb7850b46c25 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S | |||
| @@ -1865,7 +1865,7 @@ syscall_restore: | |||
| 1865 | 1865 | ||
| 1866 | /* Are we being ptraced? */ | 1866 | /* Are we being ptraced? */ |
| 1867 | ldw TASK_FLAGS(%r1),%r19 | 1867 | ldw TASK_FLAGS(%r1),%r19 |
| 1868 | ldi (_TIF_SINGLESTEP|_TIF_BLOCKSTEP),%r2 | 1868 | ldi _TIF_SYSCALL_TRACE_MASK,%r2 |
| 1869 | and,COND(=) %r19,%r2,%r0 | 1869 | and,COND(=) %r19,%r2,%r0 |
| 1870 | b,n syscall_restore_rfi | 1870 | b,n syscall_restore_rfi |
| 1871 | 1871 | ||
| @@ -1978,15 +1978,23 @@ syscall_restore_rfi: | |||
| 1978 | /* sr2 should be set to zero for userspace syscalls */ | 1978 | /* sr2 should be set to zero for userspace syscalls */ |
| 1979 | STREG %r0,TASK_PT_SR2(%r1) | 1979 | STREG %r0,TASK_PT_SR2(%r1) |
| 1980 | 1980 | ||
| 1981 | pt_regs_ok: | ||
| 1982 | LDREG TASK_PT_GR31(%r1),%r2 | 1981 | LDREG TASK_PT_GR31(%r1),%r2 |
| 1983 | depi 3,31,2,%r2 /* ensure return to user mode. */ | 1982 | depi 3,31,2,%r2 /* ensure return to user mode. */ |
| 1984 | STREG %r2,TASK_PT_IAOQ0(%r1) | 1983 | STREG %r2,TASK_PT_IAOQ0(%r1) |
| 1985 | ldo 4(%r2),%r2 | 1984 | ldo 4(%r2),%r2 |
| 1986 | STREG %r2,TASK_PT_IAOQ1(%r1) | 1985 | STREG %r2,TASK_PT_IAOQ1(%r1) |
| 1986 | b intr_restore | ||
| 1987 | copy %r25,%r16 | 1987 | 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) | ||
| 1988 | b intr_restore | 1996 | b intr_restore |
| 1989 | nop | 1997 | copy %r25,%r16 |
| 1990 | 1998 | ||
| 1991 | .import schedule,code | 1999 | .import schedule,code |
| 1992 | syscall_do_resched: | 2000 | syscall_do_resched: |
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 857c2f545470..534abd4936e1 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #include <asm/asm-offsets.h> | 26 | #include <asm/asm-offsets.h> |
| 27 | 27 | ||
| 28 | /* PSW bits we allow the debugger to modify */ | 28 | /* 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) |
| 30 | 30 | ||
| 31 | /* | 31 | /* |
| 32 | * Called by kernel/ptrace.c when detaching.. | 32 | * Called by kernel/ptrace.c when detaching.. |
