[llvm] 7706c30 - [llvm-exegesis] Print signal name when the snippet crashed.
Clement Courbet via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 2 01:42:16 PST 2020
Author: Clement Courbet
Date: 2020-11-02T10:41:17+01:00
New Revision: 7706c3022ead52d49cf455df7e7c289a485aa6ec
URL: https://github.com/llvm/llvm-project/commit/7706c3022ead52d49cf455df7e7c289a485aa6ec
DIFF: https://github.com/llvm/llvm-project/commit/7706c3022ead52d49cf455df7e7c289a485aa6ec.diff
LOG: [llvm-exegesis] Print signal name when the snippet crashed.
Differential Revision: https://reviews.llvm.org/D90453
Added:
Modified:
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index f015147b0fc2..1bbad207a27e 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -101,9 +101,19 @@ class FunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor {
Counter->stop();
});
CrashRecoveryContext::Disable();
- // FIXME: Better diagnosis.
- if (Crashed)
- return make_error<SnippetCrash>("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<SnippetCrash>(std::move(Msg));
+ }
}
auto ValueOrError = Counter->readOrError(Function.getFunctionBytes());
More information about the llvm-commits
mailing list