From f75771cc8fb0e5d2e6a993294b6ce5178a4171b4 Mon Sep 17 00:00:00 2001 From: Josef Weidendorfer Date: Tue, 11 Aug 2009 14:45:03 +0000 Subject: [PATCH] Fix bug 199338: callgrind_annotate sorting/thresholds are broken git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10778 --- callgrind/callgrind_annotate.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/callgrind/callgrind_annotate.in b/callgrind/callgrind_annotate.in index 0a8c301285..afa9e04bff 100644 --- a/callgrind/callgrind_annotate.in +++ b/callgrind/callgrind_annotate.in @@ -243,17 +243,21 @@ sub process_cmd_line() # --sort=A,B,C } elsif ($arg =~ /^--sort=(.*)$/) { @sort_events = split(/,/, $1); + my $th_specified = 0; foreach my $i (0 .. scalar @sort_events - 1) { - if ($sort_events[$i] =~#/.*:(\d+)$/) { - /.*:([\d\.]+)%?$/) { + if ($sort_events[$i] =~ /.*:([\d\.]+)%?$/) { my $th = $1; ($th >= 0 && $th <= 100) or die($usage); $sort_events[$i] =~ s/:.*//; $thresholds[$i] = $th; + $th_specified = 1; } else { $thresholds[$i] = 0; } } + if (not $th_specified) { + @thresholds = (); + } # --threshold=X (tolerates a trailing '%') } elsif ($arg =~ /^--threshold=([\d\.]+)%?$/) { -- 2.47.3