powerpc/ptrace: Add DAWR debug feature info for userspace
authorMichael Neuling <mikey@neuling.org>
Thu, 21 Mar 2013 20:12:33 +0000 (20:12 +0000)
committerMichael Ellerman <michael@ellerman.id.au>
Thu, 18 Apr 2013 05:59:55 +0000 (15:59 +1000)
This adds new debug feature information so that the DAWR can be
identified by userspace tools like GDB.

Unfortunately the DAWR doesn't sit nicely into the current description
that ptrace provides to userspace via struct ppc_debug_info.  It doesn't
allow for specifying that only some ranges are possible or even the end
alignment constraints (DAWR only allows 512 byte wide ranges which can't
cross a 512 byte boundary).

After talking to Edjunior Machado (GDB ppc developer), it was decided
this was the best approach.  Just mark it as debug feature DAWR and
tools like GDB can internally decide the constraints.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Documentation/powerpc/ptrace.txt
arch/powerpc/include/uapi/asm/ptrace.h
arch/powerpc/kernel/ptrace.c

index f2a7a3919772ef8e36075231cdad82435cba718a..99c5ce88d0fe0b8b7179db04e4b8c798e6c7380f 100644 (file)
@@ -40,6 +40,7 @@ features will have bits indicating whether there is support for:
 #define PPC_DEBUG_FEATURE_INSN_BP_MASK         0x2
 #define PPC_DEBUG_FEATURE_DATA_BP_RANGE                0x4
 #define PPC_DEBUG_FEATURE_DATA_BP_MASK         0x8
+#define PPC_DEBUG_FEATURE_DATA_BP_DAWR         0x10
 
 2. PTRACE_SETHWDEBUG
 
index 66b9ca4ee94ab0c4f05cf0a96efac790dfb15b0e..77d2ed35b111677b32c5c8b67d9f80fe947bcf93 100644 (file)
@@ -211,6 +211,7 @@ struct ppc_debug_info {
 #define PPC_DEBUG_FEATURE_INSN_BP_MASK         0x0000000000000002
 #define PPC_DEBUG_FEATURE_DATA_BP_RANGE                0x0000000000000004
 #define PPC_DEBUG_FEATURE_DATA_BP_MASK         0x0000000000000008
+#define PPC_DEBUG_FEATURE_DATA_BP_DAWR         0x0000000000000010
 
 #ifndef __ASSEMBLY__
 
index 10ade3c0c88af79a30135574e42eed28a8f1f3f9..3b14d320e69f81737b447b59bcef4046edde0b5a 100644 (file)
@@ -1644,6 +1644,8 @@ long arch_ptrace(struct task_struct *child, long request,
                dbginfo.sizeof_condition = 0;
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
                dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE;
+               if (cpu_has_feature(CPU_FTR_DAWR))
+                       dbginfo.features |= PPC_DEBUG_FEATURE_DATA_BP_DAWR;
 #else
                dbginfo.features = 0;
 #endif /* CONFIG_HAVE_HW_BREAKPOINT */