[Lldb-commits] [lldb] b26d9e4 - [Reproducer] Instruct users to replay reproducer

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 21 13:38:56 PST 2019


Author: Jonas Devlieghere
Date: 2019-11-21T13:25:53-08:00
New Revision: b26d9e417d2d4dbb47f6e967926dbb31f6d7a4b4

URL: https://github.com/llvm/llvm-project/commit/b26d9e417d2d4dbb47f6e967926dbb31f6d7a4b4
DIFF: https://github.com/llvm/llvm-project/commit/b26d9e417d2d4dbb47f6e967926dbb31f6d7a4b4.diff

LOG: [Reproducer] Instruct users to replay reproducer

Improve the message printed when LLDB crashes by asking the user to
replay the reproducer before attaching it to a bugreport..

********************
Crash reproducer for lldb version 10.0.0 (git at github.com:llvm/llvm-project.git revision ...)
  clang revision ...
  llvm revision ...

Reproducer written to '/path/to/reproducer'

Before attaching the reproducer to a bug report:
 - Look at the directory to ensure you're willing to share its content.
 - Make sure the reproducer works by replaying the reproducer.

Replay the reproducer with the following command:
./bin/lldb -replay /path/to/reproducer
********************

Added: 
    

Modified: 
    lldb/tools/driver/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 806922bc860f..465ccdb95393 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -732,16 +732,24 @@ void sigcont_handler(int signo) {
   signal(signo, sigcont_handler);
 }
 
-void reproducer_handler(void *) {
+void reproducer_handler(void *argv0) {
   if (SBReproducer::Generate()) {
+    auto exe = static_cast<const char *>(argv0);
     llvm::outs() << "********************\n";
     llvm::outs() << "Crash reproducer for ";
     llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
+    llvm::outs() << '\n';
     llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
                  << "'\n";
+    llvm::outs() << '\n';
+    llvm::outs() << "Before attaching the reproducer to a bug report:\n";
+    llvm::outs() << " - Look at the directory to ensure you're willing to "
+                    "share its content.\n";
     llvm::outs()
-        << "Please have a look at the directory to assess if you're willing to "
-           "share the contained information.\n";
+        << " - Make sure the reproducer works by replaying the reproducer.\n";
+    llvm::outs() << '\n';
+    llvm::outs() << "Replay the reproducer with the following command:\n";
+    llvm::outs() << exe << " -replay " << SBReproducer::GetPath() << "\n";
     llvm::outs() << "********************\n";
   }
 }
@@ -847,7 +855,7 @@ int main(int argc, char const *argv[]) {
   }
 
   // Register the reproducer signal handler.
-  llvm::sys::AddSignalHandler(reproducer_handler, nullptr);
+  llvm::sys::AddSignalHandler(reproducer_handler, (void *)(argv[0]));
 
   SBError error = SBDebugger::InitializeWithErrorHandling();
   if (error.Fail()) {


        


More information about the lldb-commits mailing list