about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2017-03-18 10:40:33 +0000
committerDan Liew <delcypher@gmail.com>2017-03-23 15:12:20 +0000
commitd2f335bb6be7c6739223ea68edf453a7f8f53401 (patch)
treec863826ab196e32618c3e0236f7edc86d7211ced /lib
parent2806c2037c2e3ad9e29b33f88e0dae6b2d9d9df0 (diff)
downloadklee-d2f335bb6be7c6739223ea68edf453a7f8f53401.tar.gz
[WIP] Fix bug where stats would not be updated on early exit caused by
finding a bug with the `-exit-on-error` option enabled.
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/Executor.cpp7
-rw-r--r--lib/Core/Executor.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 95812dd7..1930cdc3 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -3835,6 +3835,13 @@ size_t Executor::getAllocationAlignment(const llvm::Value *allocSite) const {
          "Returned alignment must be a power of two");
   return alignment;
 }
+
+void Executor::prepareForEarlyExit() {
+  if (statsTracker) {
+    // Make sure stats get flushed out
+    statsTracker->done();
+  }
+}
 ///
 
 Interpreter *Interpreter::create(LLVMContext &ctx, const InterpreterOptions &opts,
diff --git a/lib/Core/Executor.h b/lib/Core/Executor.h
index 7c18ae1f..c3f6e705 100644
--- a/lib/Core/Executor.h
+++ b/lib/Core/Executor.h
@@ -487,6 +487,8 @@ public:
     inhibitForking = value;
   }
 
+  void prepareForEarlyExit();
+
   /*** State accessor methods ***/
 
   virtual unsigned getPathStreamID(const ExecutionState &state);