diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -101,9 +101,19 @@ Counter->stop(); }); CrashRecoveryContext::Disable(); - // FIXME: Better diagnosis. - if (Crashed) - return make_error("snippet crashed while running"); + if (Crashed) { + std::string Msg = "snippet crashed while running"; +#ifdef LLVM_ON_UNIX + // See "Exit Status for Commands": + // https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html + constexpr const int kSigOffset = 128; + if (const char *const SigName = strsignal(CRC.RetCode - kSigOffset)) { + Msg += ": "; + Msg += SigName; + } +#endif + return make_error(std::move(Msg)); + } } auto ValueOrError = Counter->readOrError(Function.getFunctionBytes());