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>
This commit is contained in:
committed by
Ingo Molnar
parent
5fa10b28e5
commit
dd1853c3f4
@ -51,13 +51,13 @@ static void sample_hbp_handler(struct perf_event *temp, void *data)
|
||||
static int __init hw_break_module_init(void)
|
||||
{
|
||||
int ret;
|
||||
unsigned long addr;
|
||||
DEFINE_BREAKPOINT_ATTR(attr);
|
||||
|
||||
addr = kallsyms_lookup_name(ksym_name);
|
||||
attr.bp_addr = kallsyms_lookup_name(ksym_name);
|
||||
attr.bp_len = HW_BREAKPOINT_LEN_4;
|
||||
attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R;
|
||||
|
||||
sample_hbp = register_wide_hw_breakpoint(addr, HW_BREAKPOINT_LEN_4,
|
||||
HW_BREAKPOINT_W | HW_BREAKPOINT_R,
|
||||
sample_hbp_handler, true);
|
||||
sample_hbp = register_wide_hw_breakpoint(&attr, sample_hbp_handler);
|
||||
if (IS_ERR(sample_hbp)) {
|
||||
ret = PTR_ERR(sample_hbp);
|
||||
goto fail;
|
||||
|
Reference in New Issue
Block a user