diff options
Diffstat (limited to 'tools/perf/util/probe-finder.c')
-rw-r--r-- | tools/perf/util/probe-finder.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 1e6c65ebbd80..c171a243d05b 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -333,8 +333,8 @@ static void show_location(Dwarf_Op *op, struct probe_finder *pf) | |||
333 | die("%u exceeds max register number.", regn); | 333 | die("%u exceeds max register number.", regn); |
334 | 334 | ||
335 | if (deref) | 335 | if (deref) |
336 | ret = snprintf(pf->buf, pf->len, " %s=+%ju(%s)", | 336 | ret = snprintf(pf->buf, pf->len, " %s=%+jd(%s)", |
337 | pf->var, (uintmax_t)offs, regs); | 337 | pf->var, (intmax_t)offs, regs); |
338 | else | 338 | else |
339 | ret = snprintf(pf->buf, pf->len, " %s=%s", pf->var, regs); | 339 | ret = snprintf(pf->buf, pf->len, " %s=%s", pf->var, regs); |
340 | DIE_IF(ret < 0); | 340 | DIE_IF(ret < 0); |
@@ -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 | ||
@@ -455,6 +453,9 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf) | |||
455 | /* *pf->fb_ops will be cached in libdw. Don't free it. */ | 453 | /* *pf->fb_ops will be cached in libdw. Don't free it. */ |
456 | pf->fb_ops = NULL; | 454 | pf->fb_ops = NULL; |
457 | 455 | ||
456 | if (pp->found == MAX_PROBES) | ||
457 | die("Too many( > %d) probe point found.\n", MAX_PROBES); | ||
458 | |||
458 | pp->probes[pp->found] = strdup(tmp); | 459 | pp->probes[pp->found] = strdup(tmp); |
459 | pp->found++; | 460 | pp->found++; |
460 | } | 461 | } |
@@ -641,7 +642,6 @@ static void find_probe_point_by_func(struct probe_finder *pf) | |||
641 | int find_probe_point(int fd, struct probe_point *pp) | 642 | int find_probe_point(int fd, struct probe_point *pp) |
642 | { | 643 | { |
643 | struct probe_finder pf = {.pp = pp}; | 644 | struct probe_finder pf = {.pp = pp}; |
644 | int ret; | ||
645 | Dwarf_Off off, noff; | 645 | Dwarf_Off off, noff; |
646 | size_t cuhl; | 646 | size_t cuhl; |
647 | Dwarf_Die *diep; | 647 | Dwarf_Die *diep; |
@@ -668,10 +668,6 @@ int find_probe_point(int fd, struct probe_point *pp) | |||
668 | pf.fname = NULL; | 668 | pf.fname = NULL; |
669 | 669 | ||
670 | if (!pp->file || pf.fname) { | 670 | if (!pp->file || pf.fname) { |
671 | /* Save CU base address (for frame_base) */ | ||
672 | ret = dwarf_lowpc(&pf.cu_die, &pf.cu_base); | ||
673 | if (ret != 0) | ||
674 | pf.cu_base = 0; | ||
675 | if (pp->function) | 671 | if (pp->function) |
676 | find_probe_point_by_func(&pf); | 672 | find_probe_point_by_func(&pf); |
677 | else if (pp->lazy_line) | 673 | else if (pp->lazy_line) |