* [PATCH] hw_breakpoint: remove sample code from hw_breakpoint.h
@ 2009-07-07 5:40 Li Zefan
2009-07-07 21:04 ` Frederic Weisbecker
0 siblings, 1 reply; 3+ messages in thread
From: Li Zefan @ 2009-07-07 5:40 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Alan Stern, K.Prasad, Frederic Weisbecker, LKML
The sample code is a bit out-dated, and there's already a
sample in sample/hw_breakpoint/.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
include/asm-generic/hw_breakpoint.h | 41 +---------------------------------
1 files changed, 2 insertions(+), 39 deletions(-)
diff --git a/include/asm-generic/hw_breakpoint.h b/include/asm-generic/hw_breakpoint.h
index 9bf2d12..30ab37c 100644
--- a/include/asm-generic/hw_breakpoint.h
+++ b/include/asm-generic/hw_breakpoint.h
@@ -60,45 +60,8 @@
* Breakpoints are disabled during execution @triggered, to avoid
* recursive traps and allow unhindered access to breakpointed memory.
*
- * This sample code sets a breakpoint on pid_max and registers a callback
- * function for writes to that variable. Note that it is not portable
- * as written, because not all architectures support HW_BREAKPOINT_LEN_4.
- *
- * ----------------------------------------------------------------------
- *
- * #include <asm/hw_breakpoint.h>
- *
- * struct hw_breakpoint my_bp;
- *
- * static void my_triggered(struct hw_breakpoint *bp, struct pt_regs *regs)
- * {
- * printk(KERN_DEBUG "Inside triggered routine of breakpoint exception\n");
- * dump_stack();
- * .......<more debugging output>........
- * }
- *
- * static struct hw_breakpoint my_bp;
- *
- * static int init_module(void)
- * {
- * ..........<do anything>............
- * my_bp.info.type = HW_BREAKPOINT_WRITE;
- * my_bp.info.len = HW_BREAKPOINT_LEN_4;
- *
- * my_bp.installed = (void *)my_bp_installed;
- *
- * rc = register_kernel_hw_breakpoint(&my_bp);
- * ..........<do anything>............
- * }
- *
- * static void cleanup_module(void)
- * {
- * ..........<do anything>............
- * unregister_kernel_hw_breakpoint(&my_bp);
- * ..........<do anything>............
- * }
- *
- * ----------------------------------------------------------------------
+ * See sample/hw_breakpoint/ for a sample that sets a breakpoint on
+ * a specified kernel symbol.
*/
struct hw_breakpoint {
void (*triggered)(struct hw_breakpoint *, struct pt_regs *);
--
1.5.4.rc3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] hw_breakpoint: remove sample code from hw_breakpoint.h
2009-07-07 5:40 [PATCH] hw_breakpoint: remove sample code from hw_breakpoint.h Li Zefan
@ 2009-07-07 21:04 ` Frederic Weisbecker
2009-07-13 5:28 ` Li Zefan
0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2009-07-07 21:04 UTC (permalink / raw)
To: Li Zefan; +Cc: Ingo Molnar, Alan Stern, K.Prasad, LKML
On Tue, Jul 07, 2009 at 01:40:11PM +0800, Li Zefan wrote:
> The sample code is a bit out-dated, and there's already a
> sample in sample/hw_breakpoint/.
IMHO these bits of comments are useful and don't overlap the role
of the samples in sample/
They only stand there as a quick summup.
No?
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
> include/asm-generic/hw_breakpoint.h | 41 +---------------------------------
> 1 files changed, 2 insertions(+), 39 deletions(-)
>
> diff --git a/include/asm-generic/hw_breakpoint.h b/include/asm-generic/hw_breakpoint.h
> index 9bf2d12..30ab37c 100644
> --- a/include/asm-generic/hw_breakpoint.h
> +++ b/include/asm-generic/hw_breakpoint.h
> @@ -60,45 +60,8 @@
> * Breakpoints are disabled during execution @triggered, to avoid
> * recursive traps and allow unhindered access to breakpointed memory.
> *
> - * This sample code sets a breakpoint on pid_max and registers a callback
> - * function for writes to that variable. Note that it is not portable
> - * as written, because not all architectures support HW_BREAKPOINT_LEN_4.
> - *
> - * ----------------------------------------------------------------------
> - *
> - * #include <asm/hw_breakpoint.h>
> - *
> - * struct hw_breakpoint my_bp;
> - *
> - * static void my_triggered(struct hw_breakpoint *bp, struct pt_regs *regs)
> - * {
> - * printk(KERN_DEBUG "Inside triggered routine of breakpoint exception\n");
> - * dump_stack();
> - * .......<more debugging output>........
> - * }
> - *
> - * static struct hw_breakpoint my_bp;
> - *
> - * static int init_module(void)
> - * {
> - * ..........<do anything>............
> - * my_bp.info.type = HW_BREAKPOINT_WRITE;
> - * my_bp.info.len = HW_BREAKPOINT_LEN_4;
> - *
> - * my_bp.installed = (void *)my_bp_installed;
> - *
> - * rc = register_kernel_hw_breakpoint(&my_bp);
> - * ..........<do anything>............
> - * }
> - *
> - * static void cleanup_module(void)
> - * {
> - * ..........<do anything>............
> - * unregister_kernel_hw_breakpoint(&my_bp);
> - * ..........<do anything>............
> - * }
> - *
> - * ----------------------------------------------------------------------
> + * See sample/hw_breakpoint/ for a sample that sets a breakpoint on
> + * a specified kernel symbol.
> */
> struct hw_breakpoint {
> void (*triggered)(struct hw_breakpoint *, struct pt_regs *);
> --
> 1.5.4.rc3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] hw_breakpoint: remove sample code from hw_breakpoint.h
2009-07-07 21:04 ` Frederic Weisbecker
@ 2009-07-13 5:28 ` Li Zefan
0 siblings, 0 replies; 3+ messages in thread
From: Li Zefan @ 2009-07-13 5:28 UTC (permalink / raw)
To: Frederic Weisbecker; +Cc: Ingo Molnar, Alan Stern, K.Prasad, LKML
(sorry for the late reply, I didn't see this mail..)
Frederic Weisbecker wrote:
> On Tue, Jul 07, 2009 at 01:40:11PM +0800, Li Zefan wrote:
>> The sample code is a bit out-dated, and there's already a
>> sample in sample/hw_breakpoint/.
>
>
> IMHO these bits of comments are useful and don't overlap the role
> of the samples in sample/
> They only stand there as a quick summup.
>
> No?
>
The sample here sets a breakpoint on pid_max, which is what the sample
in sample/ does.
And the code here is out-dated (and incomplete). We can fix it, but
whenver someone changes the APIs, he may forget to update the comments.
We know comments never catch up with code.
So I inclined to delete it, and add a link to sample/.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-13 5:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07 5:40 [PATCH] hw_breakpoint: remove sample code from hw_breakpoint.h Li Zefan
2009-07-07 21:04 ` Frederic Weisbecker
2009-07-13 5:28 ` Li Zefan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox