diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-11-26 22:55:54 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-27 00:22:59 -0500 |
commit | dd1853c3f493f6d22d9e5390b192a07b73d2ac0a (patch) | |
tree | af87226bcdc254ce2ab656530263e61f6552322b /samples/hw_breakpoint/data_breakpoint.c | |
parent | 5fa10b28e57f94a90535cfeafe89dcee9f47d540 (diff) |
hw-breakpoints: Use struct perf_event_attr to define kernel breakpoints
Kernel breakpoints are created using functions in which we pass
breakpoint parameters as individual variables: address, length
and type.
Although it fits well for x86, this just does not scale across
architectures that may support this api later as these may have
more or different needs. Pass in a perf_event_attr structure
instead because it is meant to evolve as much as possible into
a generic hardware breakpoint parameter structure.
Reported-by: K.Prasad <prasad@linux.vnet.ibm.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1259294154-5197-2-git-send-regression-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'samples/hw_breakpoint/data_breakpoint.c')
-rw-r--r-- | samples/hw_breakpoint/data_breakpoint.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/samples/hw_breakpoint/data_breakpoint.c b/samples/hw_breakpoint/data_breakpoint.c index ee7f9fbaffbd..29525500df00 100644 --- a/samples/hw_breakpoint/data_breakpoint.c +++ b/samples/hw_breakpoint/data_breakpoint.c | |||
@@ -51,13 +51,13 @@ static void sample_hbp_handler(struct perf_event *temp, void *data) | |||
51 | static int __init hw_break_module_init(void) | 51 | static int __init hw_break_module_init(void) |
52 | { | 52 | { |
53 | int ret; | 53 | int ret; |
54 | unsigned long addr; | 54 | DEFINE_BREAKPOINT_ATTR(attr); |
55 | 55 | ||
56 | addr = kallsyms_lookup_name(ksym_name); | 56 | attr.bp_addr = kallsyms_lookup_name(ksym_name); |
57 | attr.bp_len = HW_BREAKPOINT_LEN_4; | ||
58 | attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R; | ||
57 | 59 | ||
58 | sample_hbp = register_wide_hw_breakpoint(addr, HW_BREAKPOINT_LEN_4, | 60 | sample_hbp = register_wide_hw_breakpoint(&attr, sample_hbp_handler); |
59 | HW_BREAKPOINT_W | HW_BREAKPOINT_R, | ||
60 | sample_hbp_handler, true); | ||
61 | if (IS_ERR(sample_hbp)) { | 61 | if (IS_ERR(sample_hbp)) { |
62 | ret = PTR_ERR(sample_hbp); | 62 | ret = PTR_ERR(sample_hbp); |
63 | goto fail; | 63 | goto fail; |