linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: fix booke user_disable_single_step()
@ 2009-07-08 23:46 Dave Kleikamp
  2009-07-08 23:48 ` Josh Boyer
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Kleikamp @ 2009-07-08 23:46 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: ppc-dev

On booke processors, gdb is seeing spurious SIGTRAPs when setting a
watchpoint.

user_disable_single_step() simply quits when the DAC is non-zero.  It should
be clearing the DBCR0_IC and DBCR0_BT bits from the dbcr0 register and
TIF_SINGLESTEP from the thread flag.

Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>

diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 9fa2c7d..ef14988 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -736,15 +736,16 @@ void user_disable_single_step(struct task_struct *task)
 {
 	struct pt_regs *regs = task->thread.regs;
 
-
-#if defined(CONFIG_BOOKE)
-	/* If DAC then do not single step, skip */
-	if (task->thread.dabr)
-		return;
-#endif
-
 	if (regs != NULL) {
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#if defined(CONFIG_BOOKE)
+		/* If DAC don't clear DBCRO_IDM or MSR_DE */
+		if (task->thread.dabr)
+			task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT);
+		else {
+			task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT | DBCR0_IDM);
+			regs->msr &= ~MSR_DE;
+		}
+#elif defined(CONFIG_40x)
 		task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT | DBCR0_IDM);
 		regs->msr &= ~MSR_DE;
 #else

-- 
David Kleikamp
IBM Linux Technology Center

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc: fix booke user_disable_single_step()
  2009-07-08 23:46 [PATCH] powerpc: fix booke user_disable_single_step() Dave Kleikamp
@ 2009-07-08 23:48 ` Josh Boyer
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Boyer @ 2009-07-08 23:48 UTC (permalink / raw)
  To: Dave Kleikamp; +Cc: ppc-dev

On Wed, Jul 08, 2009 at 06:46:18PM -0500, Dave Kleikamp wrote:
>On booke processors, gdb is seeing spurious SIGTRAPs when setting a
>watchpoint.
>
>user_disable_single_step() simply quits when the DAC is non-zero.  It should
>be clearing the DBCR0_IC and DBCR0_BT bits from the dbcr0 register and
>TIF_SINGLESTEP from the thread flag.
>
>Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>

I'll test this first thing in the morning.  At first glance it looks pretty
good.

josh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-08 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-08 23:46 [PATCH] powerpc: fix booke user_disable_single_step() Dave Kleikamp
2009-07-08 23:48 ` Josh Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).