From 24271cf8d78ee4ad181ac0168cf7c2590d40502e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 2 Jun 2003 04:54:16 +0000 Subject: [PATCH] Give better information about how the passes crash git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6532 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/OptimizerDriver.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index fefca737951..d6beef541bd 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -133,8 +133,23 @@ bool BugDriver::runPasses(const std::vector &Passes, if (DeleteOutput) removeFile(OutputFilename); - if (!Quiet) std::cout << (Status ? "Crashed!\n" : "Success!\n"); + bool ExitedOK = WIFEXITED(Status) && WEXITSTATUS(Status) == 0; + + if (!Quiet) { + if (ExitedOK) + std::cout << "Success!\n"; + else if (WIFEXITED(Status)) + std::cout << "Exited with error code '" << WEXITSTATUS(Status) << "'\n"; + else if (WIFSIGNALED(Status)) + std::cout << "Crashed with signal #" << WTERMSIG(Status) << "\n"; +#ifdef WCOREDUMP + else if (WCOREDUMP(Status)) + std::cout << "Dumped core\n"; +#endif + else + std::cout << "Failed for unknown reason!\n"; + } // Was the child successful? - return Status != 0; + return !ExitedOK; }