]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
callgrind: fix setting call counter to zero if requested
authorJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Tue, 15 May 2018 18:11:41 +0000 (20:11 +0200)
committerJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Tue, 15 May 2018 18:11:41 +0000 (20:11 +0200)
We did not set the call cost counters in CLG_(zero_bbcc) to zero,
which gets called by requests to set counters to zero
- via client request
- when entering a function if configured so
- via gdb monitor command (used by callgrind_control -z)

Counters are also set to zero after they are dumped out to a file.
This does not use CLG_(zero_bbcc), and was doing the right thing.

This fixes bug 392449.

callgrind/bbcc.c

index 5716b07a70568f1bb6ca8a072ac0ec4c8c9e27de..7ba4e8a870800560e862b1a17d2a5df2c65f4bf1 100644 (file)
@@ -100,8 +100,10 @@ void CLG_(zero_bbcc)(BBCC* bbcc)
     bbcc->cost[i] = 0;
   for(i=0;i <= bbcc->bb->cjmp_count;i++) {
     bbcc->jmp[i].ecounter = 0;
-    for(jcc=bbcc->jmp[i].jcc_list; jcc; jcc=jcc->next_from)
-       CLG_(init_cost)( CLG_(sets).full, jcc->cost );
+    for(jcc=bbcc->jmp[i].jcc_list; jcc; jcc=jcc->next_from) {
+      CLG_(init_cost)( CLG_(sets).full, jcc->cost );
+      jcc->call_counter = 0;
+    }
   }
   bbcc->ecounter_sum = 0;
   bbcc->ret_counter = 0;