aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/Interpreter/Execution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-12 15:47:23 +0000
committerChris Lattner <sabre@nondot.org>2002-02-12 15:47:23 +0000
commit74030254b59dd3fcefba25c7a560fbfbde93d351 (patch)
tree516a054b16b7aee7b88ad78001e97dbffeea327c /lib/ExecutionEngine/Interpreter/Execution.cpp
parent6723addbc72ce16b0a77a8d796f43e818b4884ff (diff)
Add new abort-on-exceptions flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/Execution.cpp')
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index d3aa4ccbf6..0fad82964d 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -27,6 +27,7 @@ using std::cerr;
cl::Flag QuietMode ("quiet" , "Do not emit any non-program output");
cl::Alias QuietModeA("q" , "Alias for -quiet", cl::NoFlags, QuietMode);
cl::Flag ArrayChecksEnabled("array-checks", "Enable array bound checks");
+cl::Flag AbortOnExceptions("abort-on-exception", "Halt execution on a machine exception");
// Create a TargetData structure to handle memory addressing and size/alignment
// computations
@@ -803,7 +804,7 @@ static PointerTy getElementOffset(MemAccessInst *I, ExecutionContext &SF) {
<< " Subscript #" << (ArgOff-I->getFirstIndexOperandNumber())
<< "\n";
// Get outta here!!!
- siglongjmp(SignalRecoverBuffer, -1);
+ siglongjmp(SignalRecoverBuffer, SIGTRAP);
}
Ty = ST->getElementType();
@@ -1134,9 +1135,13 @@ bool Interpreter::executeInstruction() {
//
if (int SigNo = sigsetjmp(SignalRecoverBuffer, 1)) {
--SF.CurInst; // Back up to erroring instruction
- if (SigNo != SIGINT && SigNo != -1) {
+ if (SigNo != SIGINT) {
cout << "EXCEPTION OCCURRED [" << _sys_siglistp[SigNo] << "]:\n";
printStackTrace();
+ // If -abort-on-exception was specified, terminate LLI instead of trying
+ // to debug it.
+ //
+ if (AbortOnExceptions) exit(1);
} else if (SigNo == SIGINT) {
cout << "CTRL-C Detected, execution halted.\n";
}