about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <martin.nowack@gmail.com>2016-03-23 15:49:29 +0000
committerMartin Nowack <martin@se.inf.tu-dresden.de>2016-03-23 21:14:05 +0100
commita5f0334c0a844a0d6177c38375ec92ae8db217f9 (patch)
tree076b0e0bc6182f45d4c466e4507107a27b70b3c0
parent58f947302c9807b7f6bea2fcb2a7bb325f8dd1b2 (diff)
downloadklee-a5f0334c0a844a0d6177c38375ec92ae8db217f9.tar.gz
Add option to log partial solver queries before calling it
-rw-r--r--lib/Solver/QueryLoggingSolver.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Solver/QueryLoggingSolver.cpp b/lib/Solver/QueryLoggingSolver.cpp
index 5484a319..b6c25b55 100644
--- a/lib/Solver/QueryLoggingSolver.cpp
+++ b/lib/Solver/QueryLoggingSolver.cpp
@@ -18,6 +18,12 @@
 
 using namespace klee::util;
 
+namespace {
+llvm::cl::opt<bool> DumpPartialQueryiesEarly(
+    "log-partial-queries-early", llvm::cl::init(false),
+    llvm::cl::desc("Log queries before calling the solver (default=off)"));
+}
+
 QueryLoggingSolver::QueryLoggingSolver(Solver *_solver,
                                        std::string path,
                                        const std::string& commentSign,
@@ -53,9 +59,15 @@ void QueryLoggingSolver::startQuery(const Query& query, const char* typeName,
               << "Instructions: " << instructions << "\n";
     
     printQuery(query, falseQuery, objects);
-    
+
+    if (DumpPartialQueryiesEarly) {
+      logBuffer.flush();
+      os << logBuffer.str();
+      os.flush();
+      // prepare the buffer for reuse
+      BufferString = "";
+    }
     startTime = getWallTime();
-    
 }
 
 void QueryLoggingSolver::finishQuery(bool success) {
@@ -199,4 +211,3 @@ char *QueryLoggingSolver::getConstraintLog(const Query& query) {
 void QueryLoggingSolver::setCoreSolverTimeout(double timeout) {
   solver->impl->setCoreSolverTimeout(timeout);
 }
-