summaryrefslogtreecommitdiffstats
path: root/tools/bugpoint/ToolRunner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bugpoint/ToolRunner.cpp')
-rw-r--r--tools/bugpoint/ToolRunner.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp
index 6c46ef1..0d98262 100644
--- a/tools/bugpoint/ToolRunner.cpp
+++ b/tools/bugpoint/ToolRunner.cpp
@@ -854,9 +854,18 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
if (RemoteClientPath.isEmpty()) {
DEBUG(errs() << "<run locally>");
- return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
+ int ExitCode = RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
Timeout, MemoryLimit, Error);
+ // 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();
+ Error->clear();
+ }
+ return ExitCode;
} else {
outs() << "<run remotely>"; outs().flush();
return RunProgramRemotelyWithTimeout(sys::Path(RemoteClientPath),
OpenPOWER on IntegriCloud