aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHarald Weppner <harald.weppner@tidalscale.com>2014-03-17 23:53:00 -0700
committerHarald Weppner <harald.weppner@tidalscale.com>2014-03-17 23:53:00 -0700
commitbf543df20ccd9e2c422751908cabf073bc7f5d4b (patch)
treede8cdd4edcddb50d79f33c0c519d2eb57a018a21 /bin
parent9e20df163c0c608026498b8fb5beab35e8a049c6 (diff)
downloadjemalloc-bf543df20ccd9e2c422751908cabf073bc7f5d4b.tar.gz
Enable profiling / leak detection in FreeBSD
* Assumes procfs is mounted at /proc, cf. <http://www.freebsd.org/doc/en/articles/linux-users/procfs.html>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pprof22
1 files changed, 20 insertions, 2 deletions
diff --git a/bin/pprof b/bin/pprof
index 727eb43..08c9ea3 100755
--- a/bin/pprof
+++ b/bin/pprof
@@ -4197,8 +4197,12 @@ sub FindLibrary {
# For libc libraries, the copy in /usr/lib/debug contains debugging symbols
sub DebuggingLibrary {
my $file = shift;
- if ($file =~ m|^/| && -f "/usr/lib/debug$file") {
- return "/usr/lib/debug$file";
+ if ($file =~ m|^/|) {
+ if (-f "/usr/lib/debug$file") {
+ return "/usr/lib/debug$file";
+ } elsif (-f "/usr/lib/debug$file.debug") {
+ return "/usr/lib/debug$file.debug";
+ }
}
return undef;
}
@@ -4360,6 +4364,19 @@ sub ParseLibraries {
$finish = HexExtend($2);
$offset = $zero_offset;
$lib = $3;
+ }
+ # FreeBSD 10.0 virtual memory map /proc/curproc/map as defined in
+ # function procfs_doprocmap (sys/fs/procfs/procfs_map.c)
+ #
+ # Example:
+ # 0x800600000 0x80061a000 26 0 0xfffff800035a0000 r-x 75 33 0x1004 COW NC vnode /libexec/ld-elf.s
+ # o.1 NCH -1
+ elsif ($l =~ /^(0x$h)\s(0x$h)\s\d+\s\d+\s0x$h\sr-x\s\d+\s\d+\s0x\d+\s(COW|NCO)\s(NC|NNC)\svnode\s(\S+\.so(\.\d+)*)/) {
+ $start = HexExtend($1);
+ $finish = HexExtend($2);
+ $offset = $zero_offset;
+ $lib = FindLibrary($5);
+
} else {
next;
}
@@ -4382,6 +4399,7 @@ sub ParseLibraries {
}
}
+ if($main::opt_debug) { printf STDERR "$start:$finish ($offset) $lib\n"; }
push(@{$result}, [$lib, $start, $finish, $offset]);
}