diff --git a/jemalloc/bin/pprof b/jemalloc/bin/pprof index 73d35dda..e42d3b22 100755 --- a/jemalloc/bin/pprof +++ b/jemalloc/bin/pprof @@ -3682,16 +3682,9 @@ sub ExtractSymbols { # Map each PC value to the containing library my @pcs = (sort { $a cmp $b } keys(%{$pcset})); - my @slibs = (sort {$a->[1] cmp $b->[1]} @{$libs}); - my $bin = shift(@slibs); - if ($bin->[1] == 0) { - # Move binary to end (starts at address 0). - push(@slibs, $bin); - } else { - unshift(@slibs, $bin); - } - my $pc = shift(@pcs); - foreach my $lib (@slibs) { + my $pc = pop(@pcs); + + foreach my $lib (reverse sort {$a->[1] cmp $b->[1]} @{$libs}) { my $libname = $lib->[0]; my $start = $lib->[1]; my $finish = $lib->[2]; @@ -3701,7 +3694,7 @@ sub ExtractSymbols { my $contained = []; while (($pc ge $start) && ($pc le $finish)) { push(@{$contained}, $pc); - $pc = shift(@pcs); + $pc = pop(@pcs); if (!defined $pc) { last; }