diff options
Diffstat (limited to 'lib/Core/Executor.h')
-rw-r--r-- | lib/Core/Executor.h | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/lib/Core/Executor.h b/lib/Core/Executor.h index 600c7b90..93d1443e 100644 --- a/lib/Core/Executor.h +++ b/lib/Core/Executor.h @@ -101,7 +101,24 @@ public: typedef std::pair<ExecutionState*,ExecutionState*> StatePair; + enum TerminateReason { + Abort, + Assert, + Exec, + External, + Free, + Model, + Overflow, + Ptr, + ReadOnly, + ReportError, + User, + Unhandled + }; + private: + static const char *TerminateReasonNames[]; + class TimerInfo; KModule *kmodule; @@ -122,12 +139,12 @@ private: /// instructions step. /// \invariant \ref addedStates is a subset of \ref states. /// \invariant \ref addedStates and \ref removedStates are disjoint. - std::set<ExecutionState*> addedStates; + std::vector<ExecutionState *> addedStates; /// Used to track states that have been removed during the current /// instructions step. /// \invariant \ref removedStates is a subset of \ref states. /// \invariant \ref addedStates and \ref removedStates are disjoint. - std::set<ExecutionState*> removedStates; + std::vector<ExecutionState *> removedStates; /// When non-empty the Executor is running in "seed" mode. The /// states in this map will be executed in an arbitrary order @@ -362,6 +379,8 @@ private: const InstructionInfo & getLastNonKleeInternalInstruction(const ExecutionState &state, llvm::Instruction** lastInstruction); + bool shouldExitOn(enum TerminateReason termReason); + // remove state from queue and delete void terminateState(ExecutionState &state); // call exit handler and terminate state @@ -369,10 +388,10 @@ private: // call exit handler and terminate state void terminateStateOnExit(ExecutionState &state); // call error handler and terminate state - void terminateStateOnError(ExecutionState &state, - const llvm::Twine &message, - const char *suffix, - const llvm::Twine &longMessage=""); + void terminateStateOnError(ExecutionState &state, const llvm::Twine &message, + enum TerminateReason termReason, + const char *suffix = NULL, + const llvm::Twine &longMessage = ""); // call error handler and terminate state, for execution errors // (things that should not be possible, like illegal instruction or @@ -380,7 +399,7 @@ private: void terminateStateOnExecError(ExecutionState &state, const llvm::Twine &message, const llvm::Twine &info="") { - terminateStateOnError(state, message, "exec.err", info); + terminateStateOnError(state, message, Exec, NULL, info); } /// bindModuleConstants - Initialize the module constant table. @@ -412,6 +431,7 @@ private: double maxInstTime); void checkMemoryUsage(); void printDebugInstructions(ExecutionState &state); + void doDumpStates(); public: Executor(const InterpreterOptions &opts, InterpreterHandler *ie); |