]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
vg_annotate.in:
authorNicholas Nethercote <njn@valgrind.org>
Mon, 10 Jun 2002 15:31:16 +0000 (15:31 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Mon, 10 Jun 2002 15:31:16 +0000 (15:31 +0000)
    - 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

cachegrind/cg_annotate.in
cachegrind/cg_main.c
vg_annotate.in
vg_cachesim.c

index 4f8c846a668ffffd12fedb0d5aed6fe4882b5364..11821901c22bdbd457f959161d33d9c19194ded2 100644 (file)
@@ -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;
index 977ad3dfd147914a6425f983f15ec41bda5c3496..8fa6f326b774393b7e7ba145841c1d711ce1f24b 100644 (file)
@@ -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;
    }
 }
 
index 4f8c846a668ffffd12fedb0d5aed6fe4882b5364..11821901c22bdbd457f959161d33d9c19194ded2 100644 (file)
@@ -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;
index 977ad3dfd147914a6425f983f15ec41bda5c3496..8fa6f326b774393b7e7ba145841c1d711ce1f24b 100644 (file)
@@ -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;
    }
 }