1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Add new abort-on-exceptions flag

llvm-svn: 1737
This commit is contained in:
Chris Lattner 2002-02-12 15:47:23 +00:00
parent fa74003797
commit ce754be520

View File

@ -27,6 +27,7 @@ using std::cerr;
cl::Flag QuietMode ("quiet" , "Do not emit any non-program output"); cl::Flag QuietMode ("quiet" , "Do not emit any non-program output");
cl::Alias QuietModeA("q" , "Alias for -quiet", cl::NoFlags, QuietMode); cl::Alias QuietModeA("q" , "Alias for -quiet", cl::NoFlags, QuietMode);
cl::Flag ArrayChecksEnabled("array-checks", "Enable array bound checks"); 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 // Create a TargetData structure to handle memory addressing and size/alignment
// computations // computations
@ -803,7 +804,7 @@ static PointerTy getElementOffset(MemAccessInst *I, ExecutionContext &SF) {
<< " Subscript #" << (ArgOff-I->getFirstIndexOperandNumber()) << " Subscript #" << (ArgOff-I->getFirstIndexOperandNumber())
<< "\n"; << "\n";
// Get outta here!!! // Get outta here!!!
siglongjmp(SignalRecoverBuffer, -1); siglongjmp(SignalRecoverBuffer, SIGTRAP);
} }
Ty = ST->getElementType(); Ty = ST->getElementType();
@ -1134,9 +1135,13 @@ bool Interpreter::executeInstruction() {
// //
if (int SigNo = sigsetjmp(SignalRecoverBuffer, 1)) { if (int SigNo = sigsetjmp(SignalRecoverBuffer, 1)) {
--SF.CurInst; // Back up to erroring instruction --SF.CurInst; // Back up to erroring instruction
if (SigNo != SIGINT && SigNo != -1) { if (SigNo != SIGINT) {
cout << "EXCEPTION OCCURRED [" << _sys_siglistp[SigNo] << "]:\n"; cout << "EXCEPTION OCCURRED [" << _sys_siglistp[SigNo] << "]:\n";
printStackTrace(); printStackTrace();
// If -abort-on-exception was specified, terminate LLI instead of trying
// to debug it.
//
if (AbortOnExceptions) exit(1);
} else if (SigNo == SIGINT) { } else if (SigNo == SIGINT) {
cout << "CTRL-C Detected, execution halted.\n"; cout << "CTRL-C Detected, execution halted.\n";
} }