aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core/Searcher.cpp
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2013-08-07 13:22:06 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2013-08-07 13:22:06 +0100
commit363e7ab2d7bfa790b666eac1b48b7b7daf02e5e3 (patch)
tree6716b850795baa8ae09312e7cc6952f24627624f /lib/Core/Searcher.cpp
parent357ecb515baaa018a5b4b611f7cb4000e91315d3 (diff)
parent939d6874d114f5a39396f28aeb6ebc17a0dc652b (diff)
downloadklee-363e7ab2d7bfa790b666eac1b48b7b7daf02e5e3.tar.gz
Merge branch 'bfs' of https://github.com/antiAgainst/klee into antiAgainst-bfs
Diffstat (limited to 'lib/Core/Searcher.cpp')
-rw-r--r--lib/Core/Searcher.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/Core/Searcher.cpp b/lib/Core/Searcher.cpp
index d08cd1b1..778ef0ef 100644
--- a/lib/Core/Searcher.cpp
+++ b/lib/Core/Searcher.cpp
@@ -88,6 +88,40 @@ void DFSSearcher::update(ExecutionState *current,
///
+ExecutionState &BFSSearcher::selectState() {
+ return *states.front();
+}
+
+void BFSSearcher::update(ExecutionState *current,
+ const std::set<ExecutionState*> &addedStates,
+ const std::set<ExecutionState*> &removedStates) {
+ states.insert(states.end(),
+ addedStates.begin(),
+ addedStates.end());
+ for (std::set<ExecutionState*>::const_iterator it = removedStates.begin(),
+ ie = removedStates.end(); it != ie; ++it) {
+ ExecutionState *es = *it;
+ if (es == states.front()) {
+ states.pop_front();
+ } else {
+ bool ok = false;
+
+ for (std::deque<ExecutionState*>::iterator it = states.begin(),
+ ie = states.end(); it != ie; ++it) {
+ if (es==*it) {
+ states.erase(it);
+ ok = true;
+ break;
+ }
+ }
+
+ assert(ok && "invalid state removed");
+ }
+ }
+}
+
+///
+
ExecutionState &RandomSearcher::selectState() {
return *states[theRNG.getInt32()%states.size()];
}