aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-03-15 13:02:35 -0400
committerIngo Molnar <mingo@elte.hu>2010-03-16 05:02:19 -0400
commitd0cb4260f899d07462d49fc67e29f2438dbaca2f (patch)
tree09633fcc1f2bc5a5d172878f7991d440f9180043
parent67c7ff7c56f38a8ab338fbbfe366621ce6303ba1 (diff)
perf probe: Use original address instead of CU-based address
Use original address for looking up the location of variables for dwarf_getlocation_addr() instead of CU-based address. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> LKML-Reference: <20100315170235.31852.91195.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--tools/perf/util/probe-finder.c11
-rw-r--r--tools/perf/util/probe-finder.h1
2 files changed, 2 insertions, 10 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 0e8c8f1594ec..c171a243d05b 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -352,8 +352,7 @@ static void show_variable(Dwarf_Die *vr_die, struct probe_finder *pf)
352 if (dwarf_attr(vr_die, DW_AT_location, &attr) == NULL) 352 if (dwarf_attr(vr_die, DW_AT_location, &attr) == NULL)
353 goto error; 353 goto error;
354 /* TODO: handle more than 1 exprs */ 354 /* TODO: handle more than 1 exprs */
355 ret = dwarf_getlocation_addr(&attr, (pf->addr - pf->cu_base), 355 ret = dwarf_getlocation_addr(&attr, pf->addr, &expr, &nexpr, 1);
356 &expr, &nexpr, 1);
357 if (ret <= 0 || nexpr == 0) 356 if (ret <= 0 || nexpr == 0)
358 goto error; 357 goto error;
359 358
@@ -437,8 +436,7 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
437 436
438 /* Get the frame base attribute/ops */ 437 /* Get the frame base attribute/ops */
439 dwarf_attr(sp_die, DW_AT_frame_base, &fb_attr); 438 dwarf_attr(sp_die, DW_AT_frame_base, &fb_attr);
440 ret = dwarf_getlocation_addr(&fb_attr, (pf->addr - pf->cu_base), 439 ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
441 &pf->fb_ops, &nops, 1);
442 if (ret <= 0 || nops == 0) 440 if (ret <= 0 || nops == 0)
443 pf->fb_ops = NULL; 441 pf->fb_ops = NULL;
444 442
@@ -644,7 +642,6 @@ static void find_probe_point_by_func(struct probe_finder *pf)
644int find_probe_point(int fd, struct probe_point *pp) 642int find_probe_point(int fd, struct probe_point *pp)
645{ 643{
646 struct probe_finder pf = {.pp = pp}; 644 struct probe_finder pf = {.pp = pp};
647 int ret;
648 Dwarf_Off off, noff; 645 Dwarf_Off off, noff;
649 size_t cuhl; 646 size_t cuhl;
650 Dwarf_Die *diep; 647 Dwarf_Die *diep;
@@ -671,10 +668,6 @@ int find_probe_point(int fd, struct probe_point *pp)
671 pf.fname = NULL; 668 pf.fname = NULL;
672 669
673 if (!pp->file || pf.fname) { 670 if (!pp->file || pf.fname) {
674 /* Save CU base address (for frame_base) */
675 ret = dwarf_lowpc(&pf.cu_die, &pf.cu_base);
676 if (ret != 0)
677 pf.cu_base = 0;
678 if (pp->function) 671 if (pp->function)
679 find_probe_point_by_func(&pf); 672 find_probe_point_by_func(&pf);
680 else if (pp->lazy_line) 673 else if (pp->lazy_line)
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index d1a651793ba6..21f7354397b4 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -71,7 +71,6 @@ struct probe_finder {
71 71
72 /* For variable searching */ 72 /* For variable searching */
73 Dwarf_Op *fb_ops; /* Frame base attribute */ 73 Dwarf_Op *fb_ops; /* Frame base attribute */
74 Dwarf_Addr cu_base; /* Current CU base address */
75 const char *var; /* Current variable name */ 74 const char *var; /* Current variable name */
76 char *buf; /* Current output buffer */ 75 char *buf; /* Current output buffer */
77 int len; /* Length of output buffer */ 76 int len; /* Length of output buffer */