From dc5948d47205fd05184a25251e128db6a47b25c2 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Sat, 21 May 2011 00:56:46 +0000 Subject: Have Program::Wait return -2 for crashed and timeouts instead of embedding info in the error message. Per Dan's request. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131780 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/OptimizerDriver.cpp | 2 +- tools/bugpoint/ToolRunner.cpp | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'tools/bugpoint') diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index c6be271ae2..336c83d7b1 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -223,7 +223,7 @@ bool BugDriver::runPasses(Module *Program, if (result == -1) outs() << "Execute failed: " << ErrMsg << "\n"; else - outs() << "Crashed with signal #" << abs(result) << "\n"; + outs() << "Crashed: " << ErrMsg << "\n"; } if (result & 0x01000000) outs() << "Dumped core\n"; diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index f9d8603b5a..0d98262b43 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -50,11 +50,6 @@ namespace { cl::desc("Remote execution (rsh/ssh) extra options")); } -// Add a prefix to ErrMsg if the program is terminated by a signal to -// distinguish compiled program crashes from other execution -// failures. Miscompilation likely results in SIGSEGV. -static const char *SignalPrefix = "Signal - "; - /// RunProgramWithTimeout - This function provides an alternate interface /// to the sys::Program::ExecuteAndWait interface. /// @see sys::Program::ExecuteAndWait @@ -82,7 +77,7 @@ static int RunProgramWithTimeout(const sys::Path &ProgramPath, return sys::Program::ExecuteAndWait(ProgramPath, Args, 0, redirects, - NumSeconds, MemoryLimit, ErrMsg, SignalPrefix); + NumSeconds, MemoryLimit, ErrMsg); } /// RunProgramRemotelyWithTimeout - This function runs the given program @@ -862,9 +857,9 @@ int GCC::ExecuteProgram(const std::string &ProgramFile, int ExitCode = RunProgramWithTimeout(OutputBinary, &ProgramArgs[0], sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile), Timeout, MemoryLimit, Error); - // Treat a signal (usually SIGSEGV) as part of the program output so that - // crash-causing miscompilation is handled seamlessly. - if (Error->find(SignalPrefix) == 0) { + // Treat a signal (usually SIGSEGV) or timeout as part of the program output + // so that crash-causing miscompilation is handled seamlessly. + if (ExitCode < -1) { std::ofstream outFile(OutputFile.c_str(), std::ios_base::app); outFile << *Error << '\n'; outFile.close(); -- cgit v1.2.3