Skip to content

Commit

Permalink
perf: Don't use 4 bytes as a default instruction breakpoint length
Browse files Browse the repository at this point in the history
4 bytes is fine as a default access for data breakpoints. But
instruction breakpoints should take the native pointer length,
otherwise we get a -EINVAL in x86-64.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
  • Loading branch information
Frederic Weisbecker committed Jun 24, 2010
1 parent f7809da commit aa59a48
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/perf/util/parse-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,15 @@ parse_breakpoint_event(const char **strp, struct perf_event_attr *attr)
return EVT_FAILED;
}

/* We should find a nice way to override the access type */
attr->bp_len = HW_BREAKPOINT_LEN_4;
/*
* We should find a nice way to override the access length
* Provide some defaults for now
*/
if (attr->bp_type == HW_BREAKPOINT_X)
attr->bp_len = sizeof(long);
else
attr->bp_len = HW_BREAKPOINT_LEN_4;

attr->type = PERF_TYPE_BREAKPOINT;

return EVT_HANDLED;
Expand Down

0 comments on commit aa59a48

Please sign in to comment.