Skip to content

Commit 517b731

Browse files
mikeympe
authored andcommitted
powerpc/ptrace: Add DAWR debug feature info for userspace
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 <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent a6a058e commit 517b731

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

Documentation/powerpc/ptrace.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ features will have bits indicating whether there is support for:
4040
#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x2
4141
#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x4
4242
#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x8
43+
#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10
4344

4445
2. PTRACE_SETHWDEBUG
4546

arch/powerpc/include/uapi/asm/ptrace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ struct ppc_debug_info {
211211
#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x0000000000000002
212212
#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x0000000000000004
213213
#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x0000000000000008
214+
#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x0000000000000010
214215

215216
#ifndef __ASSEMBLY__
216217

arch/powerpc/kernel/ptrace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,8 @@ long arch_ptrace(struct task_struct *child, long request,
16441644
dbginfo.sizeof_condition = 0;
16451645
#ifdef CONFIG_HAVE_HW_BREAKPOINT
16461646
dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE;
1647+
if (cpu_has_feature(CPU_FTR_DAWR))
1648+
dbginfo.features |= PPC_DEBUG_FEATURE_DATA_BP_DAWR;
16471649
#else
16481650
dbginfo.features = 0;
16491651
#endif /* CONFIG_HAVE_HW_BREAKPOINT */

0 commit comments

Comments
 (0)