From: Nicholas Nethercote Date: Mon, 10 Jun 2002 15:31:16 +0000 (+0000) Subject: vg_annotate.in: X-Git-Tag: svn/VALGRIND_1_0_3~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c06858a4f31682edf3bb8ddef9b8f6047181179;p=thirdparty%2Fvalgrind.git vg_annotate.in: - fixed a bug that was breaking the --threshold option. vg_cachesim.c: - fixed a bug that meant instructions that didn't have a line number in the debug info were being written in cachegrind.out with whatever was the last known line number. Now using 0. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@403 --- diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in index 4f8c846a66..11821901c2 100644 --- a/cachegrind/cg_annotate.in +++ b/cachegrind/cg_annotate.in @@ -121,6 +121,8 @@ my @thresholds; my $default_threshold = 99; +my $single_threshold = $default_threshold; + # If on, automatically annotates all files that are involved in getting over # all the threshold counts. my $auto_annotate = 0; @@ -200,7 +202,7 @@ sub process_cmd_line() # --threshold=X (tolerates a trailing '%') } elsif ($arg =~ /^--threshold=([\d\.]+)%?$/) { - $thresholds[0] = $1; + $single_threshold = $1; ($1 >= 0 && $1 <= 100) or die($usage); # --auto=yes|no @@ -343,13 +345,14 @@ sub read_input_file() push(@sort_order, $events{$sort_event}); } - # If no --threshold args give, default to 99% for the primary sort event, - # and 0% for the rest. + # If multiple threshold args weren't given via --sort, stick in the single + # threshold (either from --threshold if used, or the default otherwise) for + # the primary sort event, and 0% for the rest. if (not @thresholds) { foreach my $e (@sort_order) { push(@thresholds, 0); } - $thresholds[0] = $default_threshold; + $thresholds[0] = $single_threshold; } my $curr_file; diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 977ad3dfd1..8fa6f326b7 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -267,6 +267,7 @@ static void get_debug_info(Addr instr_addr, Char filename[FILENAME_LEN], no_debug_BBs++; VG_(strcpy)(filename, "???"); VG_(strcpy)(fn_name, "???"); + *line_num = 0; } else if ( found1 && found2) { full_debug_BBs++; @@ -278,6 +279,7 @@ static void get_debug_info(Addr instr_addr, Char filename[FILENAME_LEN], } else /*(!found1 && found2)*/ { fn_name_debug_BBs++; VG_(strcpy)(filename, "???"); + *line_num = 0; } } diff --git a/vg_annotate.in b/vg_annotate.in index 4f8c846a66..11821901c2 100644 --- a/vg_annotate.in +++ b/vg_annotate.in @@ -121,6 +121,8 @@ my @thresholds; my $default_threshold = 99; +my $single_threshold = $default_threshold; + # If on, automatically annotates all files that are involved in getting over # all the threshold counts. my $auto_annotate = 0; @@ -200,7 +202,7 @@ sub process_cmd_line() # --threshold=X (tolerates a trailing '%') } elsif ($arg =~ /^--threshold=([\d\.]+)%?$/) { - $thresholds[0] = $1; + $single_threshold = $1; ($1 >= 0 && $1 <= 100) or die($usage); # --auto=yes|no @@ -343,13 +345,14 @@ sub read_input_file() push(@sort_order, $events{$sort_event}); } - # If no --threshold args give, default to 99% for the primary sort event, - # and 0% for the rest. + # If multiple threshold args weren't given via --sort, stick in the single + # threshold (either from --threshold if used, or the default otherwise) for + # the primary sort event, and 0% for the rest. if (not @thresholds) { foreach my $e (@sort_order) { push(@thresholds, 0); } - $thresholds[0] = $default_threshold; + $thresholds[0] = $single_threshold; } my $curr_file; diff --git a/vg_cachesim.c b/vg_cachesim.c index 977ad3dfd1..8fa6f326b7 100644 --- a/vg_cachesim.c +++ b/vg_cachesim.c @@ -267,6 +267,7 @@ static void get_debug_info(Addr instr_addr, Char filename[FILENAME_LEN], no_debug_BBs++; VG_(strcpy)(filename, "???"); VG_(strcpy)(fn_name, "???"); + *line_num = 0; } else if ( found1 && found2) { full_debug_BBs++; @@ -278,6 +279,7 @@ static void get_debug_info(Addr instr_addr, Char filename[FILENAME_LEN], } else /*(!found1 && found2)*/ { fn_name_debug_BBs++; VG_(strcpy)(filename, "???"); + *line_num = 0; } }