dect
/
linux-2.6
Archived
13
0
Fork 0

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>
This commit is contained in:
Masami Hiramatsu 2010-03-15 13:02:35 -04:00 committed by Ingo Molnar
parent 67c7ff7c56
commit d0cb4260f8
2 changed files with 2 additions and 10 deletions

View File

@ -352,8 +352,7 @@ static void show_variable(Dwarf_Die *vr_die, struct probe_finder *pf)
if (dwarf_attr(vr_die, DW_AT_location, &attr) == NULL) if (dwarf_attr(vr_die, DW_AT_location, &attr) == NULL)
goto error; goto error;
/* TODO: handle more than 1 exprs */ /* TODO: handle more than 1 exprs */
ret = dwarf_getlocation_addr(&attr, (pf->addr - pf->cu_base), ret = dwarf_getlocation_addr(&attr, pf->addr, &expr, &nexpr, 1);
&expr, &nexpr, 1);
if (ret <= 0 || nexpr == 0) if (ret <= 0 || nexpr == 0)
goto error; goto error;
@ -437,8 +436,7 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
/* Get the frame base attribute/ops */ /* Get the frame base attribute/ops */
dwarf_attr(sp_die, DW_AT_frame_base, &fb_attr); dwarf_attr(sp_die, DW_AT_frame_base, &fb_attr);
ret = dwarf_getlocation_addr(&fb_attr, (pf->addr - pf->cu_base), ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
&pf->fb_ops, &nops, 1);
if (ret <= 0 || nops == 0) if (ret <= 0 || nops == 0)
pf->fb_ops = NULL; pf->fb_ops = NULL;
@ -644,7 +642,6 @@ static void find_probe_point_by_func(struct probe_finder *pf)
int find_probe_point(int fd, struct probe_point *pp) int find_probe_point(int fd, struct probe_point *pp)
{ {
struct probe_finder pf = {.pp = pp}; struct probe_finder pf = {.pp = pp};
int ret;
Dwarf_Off off, noff; Dwarf_Off off, noff;
size_t cuhl; size_t cuhl;
Dwarf_Die *diep; Dwarf_Die *diep;
@ -671,10 +668,6 @@ int find_probe_point(int fd, struct probe_point *pp)
pf.fname = NULL; pf.fname = NULL;
if (!pp->file || pf.fname) { if (!pp->file || pf.fname) {
/* Save CU base address (for frame_base) */
ret = dwarf_lowpc(&pf.cu_die, &pf.cu_base);
if (ret != 0)
pf.cu_base = 0;
if (pp->function) if (pp->function)
find_probe_point_by_func(&pf); find_probe_point_by_func(&pf);
else if (pp->lazy_line) else if (pp->lazy_line)

View File

@ -71,7 +71,6 @@ struct probe_finder {
/* For variable searching */ /* For variable searching */
Dwarf_Op *fb_ops; /* Frame base attribute */ Dwarf_Op *fb_ops; /* Frame base attribute */
Dwarf_Addr cu_base; /* Current CU base address */
const char *var; /* Current variable name */ const char *var; /* Current variable name */
char *buf; /* Current output buffer */ char *buf; /* Current output buffer */
int len; /* Length of output buffer */ int len; /* Length of output buffer */