about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2011-03-30 11:25:16 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2011-03-30 11:25:16 +0000
commit4a5dd9353adc23bac73fc80a7598422f6fcd4b4f (patch)
tree1072bfaa624d479f96ae6069c48a960a29049239 /lib
parentb06bb734c1c309c5011d6148ebc6caacd9663400 (diff)
downloadklee-4a5dd9353adc23bac73fc80a7598422f6fcd4b4f.tar.gz
Fixed bug in WeightedRandomSearcher (CoveringNew). Patch by David
Ramos: "I found a nasty little bug that I'm guess dates back to
removing all that foreach() syntactic sugar. It made
stats::minDistToUncovered = 0 at all program points, rendering
WeightedRandomSearcher (CoveringNew) pretty worthless."



git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@128536 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/StatsTracker.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 1c963bfc..8d2ec479 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -209,8 +209,10 @@ StatsTracker::StatsTracker(Executor &_executor, std::string _objectFilename,
 
     executor.addTimer(new WriteStatsTimer(this), StatsWriteInterval);
 
-    if (updateMinDistToUncovered)
+    if (updateMinDistToUncovered) {
+      computeReachableUncovered();
       executor.addTimer(new UpdateReachableTimer(this), UncoveredUpdateInterval);
+    }
   }
 
   if (OutputIStats) {
@@ -607,7 +609,7 @@ void StatsTracker::computeReachableUncovered() {
       for (Function::iterator bbIt = fnIt->begin(), bb_ie = fnIt->end(); 
            bbIt != bb_ie; ++bbIt) {
         for (BasicBlock::iterator it = bbIt->begin(), ie = bbIt->end(); 
-             it != it; ++it) {
+             it != ie; ++it) {
           if (isa<CallInst>(it) || isa<InvokeInst>(it)) {
             CallSite cs(it);
             if (isa<InlineAsm>(cs.getCalledValue())) {
@@ -653,7 +655,7 @@ void StatsTracker::computeReachableUncovered() {
       for (Function::iterator bbIt = fnIt->begin(), bb_ie = fnIt->end(); 
            bbIt != bb_ie; ++bbIt) {
         for (BasicBlock::iterator it = bbIt->begin(), ie = bbIt->end(); 
-             it != it; ++it) {
+             it != ie; ++it) {
           instructions.push_back(it);
           unsigned id = infos.getInfo(it).id;
           sm.setIndexedValue(stats::minDistToReturn, 
@@ -725,7 +727,7 @@ void StatsTracker::computeReachableUncovered() {
     for (Function::iterator bbIt = fnIt->begin(), bb_ie = fnIt->end(); 
          bbIt != bb_ie; ++bbIt) {
       for (BasicBlock::iterator it = bbIt->begin(), ie = bbIt->end(); 
-           it != it; ++it) {
+           it != ie; ++it) {
         unsigned id = infos.getInfo(it).id;
         instructions.push_back(&*it);
         sm.setIndexedValue(stats::minDistToUncovered,