From 44c61ce6c4c713b194330641f400bbf64fd2abec Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Wed, 8 Oct 2014 04:39:14 +0200 Subject: Fix parsing /proc/pid/maps dump in CPU profile data file When trying to use pprof on my machine, the symbols of my program were not being recognized. It turned out that pprof, when calculating the offset of the text list of mapped objects (the last section of the CPU profile data file), was assuming that the slot size was always 4 bytes, even on 64-bit machines. This led to ParseLibraries() reading a lot of garbage data at the beginning of the map, and consequently the regex was failing to match on the first line of the real (non-garbage) map. --- src/pprof | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pprof b/src/pprof index ad21f07..0135fed 100755 --- a/src/pprof +++ b/src/pprof @@ -3914,7 +3914,7 @@ sub ReadCPUProfile { # Parse map my $map = ''; - seek(PROFILE, $i * 4, 0); + seek(PROFILE, $i * ($address_length / 2), 0); read(PROFILE, $map, (stat PROFILE)[7]); my $r = {}; -- cgit v1.2.1