From 5fc5a67e4ca0e813fa3a0ddb360a10afba3ada8c Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Mon, 12 Apr 2010 13:17:29 -0400 Subject: [PATCH] --- yaml --- r: 191219 b: refs/heads/master c: a34a985499895a46a4dacff727d0fbc63cdc75e8 h: refs/heads/master i: 191217: f006819cd1bb4f7d9c631237d257bea630918222 191215: 32231f8fc6ed700c93d5268839ae3892c0f727a1 v: v3 --- [refs] | 2 +- trunk/tools/perf/util/probe-finder.c | 14 +++++++++++--- trunk/tools/perf/util/probe-finder.h | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 0a548e545eae..6079100700c2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 11a1ca3554b377d2a8a318a3cbf8ce10a7a2a8e4 +refs/heads/master: a34a985499895a46a4dacff727d0fbc63cdc75e8 diff --git a/trunk/tools/perf/util/probe-finder.c b/trunk/tools/perf/util/probe-finder.c index ab476736cbe7..1f4528555d42 100644 --- a/trunk/tools/perf/util/probe-finder.c +++ b/trunk/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/trunk/tools/perf/util/probe-finder.h b/trunk/tools/perf/util/probe-finder.h index 2a271321944f..310ce897229c 100644 --- a/trunk/tools/perf/util/probe-finder.h +++ b/trunk/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 */