diff options
author | fabient <fabient@FreeBSD.org> | 2012-03-28 16:23:40 +0000 |
---|---|---|
committer | fabient <fabient@FreeBSD.org> | 2012-03-28 16:23:40 +0000 |
commit | 489a0be28c58b8b3e932d455be3d6f7fb9537f3d (patch) | |
tree | 6fc1a0ba269f5fd7d58b654c676a372a778f441e /usr.sbin/pmcstat/pmcstat_log.c | |
parent | 975e7bbd400ecb5a884703dc374f2c3b22ac6de6 (diff) | |
download | FreeBSD-src-489a0be28c58b8b3e932d455be3d6f7fb9537f3d.zip FreeBSD-src-489a0be28c58b8b3e932d455be3d6f7fb9537f3d.tar.gz |
- Support inlined location in calltree output.
In case of multiple level of inlining all the locations are flattened.
Require recent binutils/addr2line (head works or binutils from ports
with the right $PATH order).
- Multiple fixes in the calltree output (recursion case, ...)
- Fix the calltree top view that previously hide some shared nodes.
Tested with Kcachegrind(kdesdk4)/qcachegrind(head).
Sponsored by: NETASQ
Diffstat (limited to 'usr.sbin/pmcstat/pmcstat_log.c')
-rw-r--r-- | usr.sbin/pmcstat/pmcstat_log.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c index 41d9095..1a9ddc6 100644 --- a/usr.sbin/pmcstat/pmcstat_log.c +++ b/usr.sbin/pmcstat/pmcstat_log.c @@ -429,7 +429,9 @@ pmcstat_image_get_aout_params(struct pmcstat_image *image) if ((fd = open(buffer, O_RDONLY, 0)) < 0 || (nbytes = read(fd, &ex, sizeof(ex))) < 0) { - warn("WARNING: Cannot determine type of \"%s\"", path); + if (args.pa_verbosity >= 2) + warn("WARNING: Cannot determine type of \"%s\"", + path); image->pi_type = PMCSTAT_IMAGE_INDETERMINABLE; if (fd != -1) (void) close(fd); @@ -639,8 +641,9 @@ pmcstat_image_get_elf_params(struct pmcstat_image *image) if ((fd = open(buffer, O_RDONLY, 0)) < 0 || (e = elf_begin(fd, ELF_C_READ, NULL)) == NULL || (elf_kind(e) != ELF_K_ELF)) { - warnx("WARNING: Cannot determine the type of \"%s\".", - buffer); + if (args.pa_verbosity >= 2) + warnx("WARNING: Cannot determine the type of \"%s\".", + buffer); goto done; } @@ -946,6 +949,7 @@ pmcstat_image_addr2line(struct pmcstat_image *image, uintfptr_t addr, char *funcname, size_t funcname_len) { static int addr2line_warn = 0; + unsigned l; char *sep, cmdline[PATH_MAX], imagepath[PATH_MAX]; int fd; @@ -961,6 +965,11 @@ pmcstat_image_addr2line(struct pmcstat_image *image, uintfptr_t addr, pmcstat_string_unintern(image->pi_fullpath)); } else close(fd); + /* + * New addr2line support recursive inline function with -i + * but the format does not add a marker when no more entries + * are available. + */ snprintf(cmdline, sizeof(cmdline), "addr2line -Cfe \"%s\"", imagepath); image->pi_addr2line = popen(cmdline, "r+"); @@ -1002,10 +1011,10 @@ pmcstat_image_addr2line(struct pmcstat_image *image, uintfptr_t addr, return (0); } *sep = '\0'; - *sourceline = atoi(sep+1); - if (*sourceline == 0) + l = atoi(sep+1); + if (l == 0) return (0); - + *sourceline = l; return (1); } |