Use generic hw-breakpoint interfaces for new PPC ptrace flags
Subsystems (3)
PATCH 1/1 Use generic hw-breakpoint interfaces for new PPC ptrace flags
Hi Ben,
Please find a patch that introduces generic hw-breakpoint
interfaces for a couple of ptrace flags used by server-class processors.
This patch has been reviewed by the community and acked-by David Gibson last year
(http://thread.gmane.org/gmane.linux.ports.ppc.embedded/47473/focus=47760)
but did not get submitted to you for inclusion (the patch applies to the latest linux-2.6 tree, with a few line adjustments). While originally a patchset of two, I'm submitting only the first (and independent) patch due to disagreements over the 2/2 patch.
Kindly consider this patch for inclusion into the relevant PowerPC tree.
Thanks,
K.Prasad
------
PPC_PTRACE_GETHWDBGINFO, PPC_PTRACE_SETHWDEBUG and PPC_PTRACE_DELHWDEBUG are PowerPC specific ptrace flags that use the watchpoint register. While they are targeted primarily towards BookE users, user-space applications such as GDB have started using them for BookS too. This patch enables the use of generic hardware breakpoint interfaces for these new flags.
Apart from the usual benefits of using generic hw-breakpoint interfaces, these changes allow debuggers (such as GDB) to use a common set of ptrace flags for their watchpoint needs and allow more precise breakpoint specification (length of the variable can be specified).
--- Documentation/powerpc/ptrace.txt | 16 ++++++++ arch/powerpc/kernel/ptrace.c | 77 +++++++++++++++++++++++++++++++++++--- 2 files changed, 87 insertions(+), 6 deletions(-)
Documentation/powerpc/ptrace.txt +16 -0
@@ -127,6 +127,22 @@ Some examples of using the structure to: p.addr2 = (uint64_t) end_range; p.condition_value = 0; +- set a watchpoint in server processors (BookS) + + p.version = 1; + p.trigger_type = PPC_BREAKPOINT_TRIGGER_RW; + p.addr_mode = PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE; + or + p.addr_mode = PPC_BREAKPOINT_MODE_EXACT; + + p.condition_mode = PPC_BREAKPOINT_CONDITION_NONE; + p.addr = (uint64_t) begin_range; + /* For PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE addr2 needs to be specified, where + * addr2 - addr <= 8 Bytes. + */ + p.addr2 = (uint64_t) end_range; + p.condition_value = 0; + 3. PTRACE_DELHWDEBUG Takes an integer which identifies an existing breakpoint or watchpoint
arch/powerpc/kernel/ptrace.c +71 -6
122 lines not on this page · raw message
Signature · 1 line
1.7.4.1
arch/powerpc/kernel/ptrace.c static int set_dac_range(struct task_struct *child, · line 1347
Quoted 6 lines · K.Prasad
arch/powerpc/kernel/ptrace.c +6
-0+#ifdef CONFIG_HAVE_HW_BREAKPOINT +int ret, len =0 ; +struct thread_struct *thread = &(child->thread); +struct perf_event *bp; +struct perf_event_attr attr; +#endif /* CONFIG_HAVE_HW_BREAKPOINT */
"ret" is unused in that function, causing a warning which breaks the build since we have -Werror. I'm fixing that locally but be more careful next time please.
Ben.
Quoted 13 lines · Benjamin Herrenschmidt
arch/powerpc/kernel/ptrace.c static int set_dac_range(struct task_struct *child, · line 1347
Quoted 6 lines · K.Prasad
arch/powerpc/kernel/ptrace.c +6
-0+#ifdef CONFIG_HAVE_HW_BREAKPOINT +int ret, len =0 ; +struct thread_struct *thread = &(child->thread); +struct perf_event *bp; +struct perf_event_attr attr; +#endif /* CONFIG_HAVE_HW_BREAKPOINT */ "ret" is unused in that function, causing a warning which breaks the build since we have -Werror. I'm fixing that locally but be more careful next time please.
Quoted 1 line
Ben.
Sorry about that warning, I clearly missed that. I guess you do a custom build with -Werror flag enabled, unlike what the normal Makefile does?
Thanks,
K.Prasad
Quoted 14 lines · K.Prasad
Quoted 13 lines · Benjamin Herrenschmidt
arch/powerpc/kernel/ptrace.c static int set_dac_range(struct task_struct *child, · line 1347
Quoted 6 lines · K.Prasad
arch/powerpc/kernel/ptrace.c +6
-0+#ifdef CONFIG_HAVE_HW_BREAKPOINT +int ret, len =0 ; +struct thread_struct *thread = &(child->thread); +struct perf_event *bp; +struct perf_event_attr attr; +#endif /* CONFIG_HAVE_HW_BREAKPOINT */ "ret" is unused in that function, causing a warning which breaks the build since we have -Werror. I'm fixing that locally but be more careful next time please.
Quoted 5 lines
Quoted 1 line
Ben.
Sorry about that warning, I clearly missed that. I guess you do a custom build with -Werror flag enabled, unlike what the normal
Makefiledoes?
The normal Makefile has -Werror enabled on arch/powerpc, you are probably using an older compiler that didn't warn on unused variables by default.
Ben.