]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge r6044 (callgrind: fix annotate script for data produced with
authorJulian Seward <jseward@acm.org>
Tue, 12 Sep 2006 21:09:17 +0000 (21:09 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 12 Sep 2006 21:09:17 +0000 (21:09 +0000)
--dump-instr=yes) (JosefW)

git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_2_BRANCH@6056

callgrind/callgrind_annotate.in

index 617354d194582860e0192dd924d19a55423c4d8e..859d51a96b10a07638d6bca8e760f76bf34b8041 100644 (file)
@@ -483,6 +483,7 @@ sub read_input_file()
     my $curr_fn;
     my $curr_name;
     my $curr_line_num = 0;
+    my $prev_line_num = 0;
 
     my $curr_cobj = "";
     my $curr_cfile = "";
@@ -496,17 +497,19 @@ sub read_input_file()
 
     # Read body of input file.
     while (<INPUTFILE>) {
+       $prev_line_num = $curr_line_num;
+
         s/#.*$//;   # remove comments
-       s/^\+(\d+)/$curr_line_num+$1/e;
-        s/^\-(\d+)/$curr_line_num-$1/e;
-        s/^\*/$curr_line_num/e;
-        if (s/^(\d+|0x\w+)\s+//) {
+        s/^\+(\d+)/$prev_line_num+$1/e;
+        s/^\-(\d+)/$prev_line_num-$1/e;
+        s/^\*/$prev_line_num/e;
+        if (s/^(-?\d+|0x\w+)\s+//) {
             $curr_line_num = $1;
            if ($has_addr) {
              if ($has_line) {
-                s/^\+(\d+)/$curr_line_num+$1/e;
-               s/^\-(\d+)/$curr_line_num-$1/e;
-                s/^\*/$curr_line_num/e;
+                s/^\+(\d+)/$prev_line_num+$1/e;
+               s/^\-(\d+)/$prev_line_num-$1/e;
+                s/^\*/$prev_line_num/e;
 
                if (s/^(\d+)\s+//) { $curr_line_num = $1; }
              }