about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorPavel Yatcheniy <yatcheniy.pavel@huawei.com>2021-02-05 18:49:15 +0300
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2021-03-04 21:10:12 +0000
commitb1ef0c8a7bd433b81c057ecad656608a82a3b7dc (patch)
tree4a56ffb4e7cbfcfad03f0a2af72c063aab541628 /lib
parenta910964ca18c3570a88f65043b0ad888ce13600e (diff)
downloadklee-b1ef0c8a7bd433b81c057ecad656608a82a3b7dc.tar.gz
[Z3] Handle the case when interruption caught by Z3
Diffstat (limited to 'lib')
-rw-r--r--lib/Solver/Z3Solver.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Solver/Z3Solver.cpp b/lib/Solver/Z3Solver.cpp
index 85943e4f..87ffbdf3 100644
--- a/lib/Solver/Z3Solver.cpp
+++ b/lib/Solver/Z3Solver.cpp
@@ -8,9 +8,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "klee/Config/config.h"
-#include "klee/Support/OptionCategories.h"
 #include "klee/Support/ErrorHandling.h"
 #include "klee/Support/FileHandling.h"
+#include "klee/Support/OptionCategories.h"
+
+#include <csignal>
 
 #ifdef ENABLE_Z3
 
@@ -322,6 +324,9 @@ bool Z3SolverImpl::internalRunSolver(
     }
     return true; // success
   }
+  if (runStatusCode == SolverImpl::SOLVER_RUN_STATUS_INTERRUPTED) {
+    raise(SIGINT);
+  }
   return false; // failed
 }
 
@@ -400,6 +405,9 @@ SolverImpl::SolverRunStatus Z3SolverImpl::handleSolverResponse(
     if (strcmp(reason, "unknown") == 0) {
       return SolverImpl::SOLVER_RUN_STATUS_FAILURE;
     }
+    if (strcmp(reason, "interrupted from keyboard") == 0) {
+      return SolverImpl::SOLVER_RUN_STATUS_INTERRUPTED;
+    }
     klee_warning("Unexpected solver failure. Reason is \"%s,\"\n", reason);
     abort();
   }