summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo M. Correia <rcorreia@wizy.org>2014-10-08 04:39:14 +0200
committerAliaksey Kandratsenka <alk@tut.by>2014-10-11 16:37:29 -0700
commit44c61ce6c4c713b194330641f400bbf64fd2abec (patch)
tree3570dc165781c12a771d88e99b8700114281a5cb
parent2a28ef24ddf8013bff59914b10902f1fb07bf9b2 (diff)
downloadgperftools-44c61ce6c4c713b194330641f400bbf64fd2abec.tar.gz
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.
-rwxr-xr-xsrc/pprof2
1 files changed, 1 insertions, 1 deletions
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 = {};