From: tip-bot for Masami Hiramatsu <mhiramat@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
hpa@zytor.com, mingo@redhat.com, efault@gmx.de,
peterz@infradead.org, fweisbec@gmail.com, tglx@linutronix.de,
mhiramat@redhat.com, mingo@elte.hu
Subject: [tip:perf/core] perf probe: Support DW_OP_call_frame_cfa in debuginfo
Date: Thu, 15 Apr 2010 07:29:18 GMT [thread overview]
Message-ID: <tip-a34a985499895a46a4dacff727d0fbc63cdc75e8@git.kernel.org> (raw)
In-Reply-To: <20100412171728.3790.98217.stgit@localhost6.localdomain6>
Commit-ID: a34a985499895a46a4dacff727d0fbc63cdc75e8
Gitweb: http://git.kernel.org/tip/a34a985499895a46a4dacff727d0fbc63cdc75e8
Author: Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Mon, 12 Apr 2010 13:17:29 -0400
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 14 Apr 2010 17:28:20 -0300
perf probe: Support DW_OP_call_frame_cfa in debuginfo
When building kernel without CONFIG_FRAME_POINTER, gcc uses
CFA (canonical frame address) for frame base. With this patch,
perf probe just gets CFI (call frame information) from debuginfo
and search corresponding CFA from the CFI. IOW, this allows
perf probe works correctly on the kernel without CONFIG_FRAME_POINTER.
<Before>
./perf probe -fn sched_slice:12 lw.weight
Fatal: DW_OP 156 is not supported.
(^^^ DW_OP_call_frame_cfa)
<After>
./perf probe -fn sched_slice:12 lw.weight
Add new event:
probe:sched_slice (on sched_slice:12 with weight=lw.weight)
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20100412171728.3790.98217.stgit@localhost6.localdomain6>
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-finder.c | 14 +++++++++++---
tools/perf/util/probe-finder.h | 1 +
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index ab47673..1f45285 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -398,7 +398,6 @@ static void convert_location(Dwarf_Op *op, struct probe_finder *pf)
const char *regs;
struct kprobe_trace_arg *tvar = pf->tvar;
- /* TODO: support CFA */
/* If this is based on frame buffer, set the offset */
if (op->atom == DW_OP_fbreg) {
if (pf->fb_ops == NULL)
@@ -629,11 +628,17 @@ static void convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
/* Get the frame base attribute/ops */
dwarf_attr(sp_die, DW_AT_frame_base, &fb_attr);
ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
- if (ret <= 0 || nops == 0)
+ if (ret <= 0 || nops == 0) {
pf->fb_ops = NULL;
+ } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
+ pf->cfi != NULL) {
+ Dwarf_Frame *frame;
+ ret = dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame);
+ DIE_IF(ret != 0);
+ dwarf_frame_cfa(frame, &pf->fb_ops, &nops);
+ }
/* Find each argument */
- /* TODO: use dwarf_cfi_addrframe */
tev->nargs = pf->pev->nargs;
tev->args = xzalloc(sizeof(struct kprobe_trace_arg) * tev->nargs);
for (i = 0; i < pf->pev->nargs; i++) {
@@ -842,6 +847,9 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
if (!dbg)
return -ENOENT;
+ /* Get the call frame information from this dwarf */
+ pf.cfi = dwarf_getcfi(dbg);
+
off = 0;
line_list__init(&pf.lcache);
/* Loop on CUs (Compilation Unit) */
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 2a27132..310ce89 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -42,6 +42,7 @@ struct probe_finder {
struct list_head lcache; /* Line cache for lazy match */
/* For variable searching */
+ Dwarf_CFI *cfi; /* Call Frame Information */
Dwarf_Op *fb_ops; /* Frame base attribute */
struct perf_probe_arg *pvar; /* Current target variable */
struct kprobe_trace_arg *tvar; /* Current result variable */
next prev parent reply other threads:[~2010-04-15 7:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-12 17:16 [PATCH -tip v3 00/10] perf-probe updates - data-structure support improvements, etc Masami Hiramatsu
2010-04-12 17:16 ` [PATCH -tip v3 01/10] perf probe: Support argument name Masami Hiramatsu
2010-04-15 7:27 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 02/10] perf probe: Use the last field name as the " Masami Hiramatsu
2010-04-15 7:28 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 03/10] tracing/kprobes: Support basic types on dynamic events Masami Hiramatsu
2010-04-15 7:28 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 04/10] perf probe: Query basic types from debuginfo Masami Hiramatsu
2010-04-12 17:45 ` Arnaldo Carvalho de Melo
2010-04-15 7:28 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 05/10] perf probe: Support basic type casting Masami Hiramatsu
2010-04-15 7:29 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 06/10] perf probe: Support DW_OP_call_frame_cfa in debuginfo Masami Hiramatsu
2010-04-15 7:29 ` tip-bot for Masami Hiramatsu [this message]
2010-05-07 16:34 ` [tip:perf/core] " Robert Richter
2010-05-07 17:16 ` Masami Hiramatsu
2010-05-07 18:31 ` Arnaldo Carvalho de Melo
2010-05-07 19:12 ` Masami Hiramatsu
2010-05-07 19:47 ` Masami Hiramatsu
2010-05-07 20:04 ` Robert Richter
2010-04-12 17:17 ` [PATCH -tip v3 07/10] perf probe: Remove die() from probe-finder code Masami Hiramatsu
2010-04-15 7:29 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 08/10] perf probe: Remove die() from probe-event code Masami Hiramatsu
2010-04-15 7:29 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 09/10] perf probe: Remove xzalloc() from util/probe-{event, finder}.c Masami Hiramatsu
2010-04-15 7:30 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:17 ` [PATCH -tip v3 10/10] perf probe: Remove xstrdup()/xstrndup() " Masami Hiramatsu
2010-04-15 7:30 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-04-12 17:49 ` [PATCH -tip v3 00/10] perf-probe updates - data-structure support improvements, etc Arnaldo Carvalho de Melo
2010-04-13 9:14 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-a34a985499895a46a4dacff727d0fbc63cdc75e8@git.kernel.org \
--to=mhiramat@redhat.com \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox