diff options
author | Fabien Thomas <fabient@FreeBSD.org> | 2012-03-28 16:23:40 +0000 |
---|---|---|
committer | Fabien Thomas <fabient@FreeBSD.org> | 2012-03-28 16:23:40 +0000 |
commit | fa18b0b2fa06308755910c56255ec7401db4eeac (patch) | |
tree | 6fc1a0ba269f5fd7d58b654c676a372a778f441e /usr.sbin/pmcstat/pmcstat_log.c | |
parent | ea573a50b38853eb314e781517efea89bd9814e7 (diff) | |
download | src-fa18b0b2fa06308755910c56255ec7401db4eeac.tar.gz src-fa18b0b2fa06308755910c56255ec7401db4eeac.zip |
- 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
Notes
Notes:
svn path=/head/; revision=233611
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 41d9095f9b64..1a9ddc616ec6 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); } |