[PATCH] D90453: [llvm-exegesis] Print signal name when the snippet crashed.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 01:42:21 PST 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7706c3022ead: [llvm-exegesis] Print signal name when the snippet crashed. (authored by courbet).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90453/new/

https://reviews.llvm.org/D90453

Files:
  llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp


Index: llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -101,9 +101,19 @@
           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());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90453.302224.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201102/5efa51dc/attachment.bin>


More information about the llvm-commits mailing list