From 4a5dd9353adc23bac73fc80a7598422f6fcd4b4f Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Wed, 30 Mar 2011 11:25:16 +0000 Subject: 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 --- lib/Core/StatsTracker.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') 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(it) || isa(it)) { CallSite cs(it); if (isa(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, -- cgit 1.4.1