[Lldb-commits] [lldb] 67bc243 - [lldb] Remove --reproducer-finalize and associated functionality

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 17 12:20:00 PST 2021


Author: Jonas Devlieghere
Date: 2021-12-17T12:19:55-08:00
New Revision: 67bc2435359a8f09f607d6c3fc0a196bd496d31f

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

LOG: [lldb] Remove --reproducer-finalize and associated functionality

This is part of a bigger rework of the reproducer feature. See [1] for
more details.

[1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html

Added: 
    

Modified: 
    lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
    lldb/tools/driver/Driver.cpp
    lldb/tools/driver/Options.td

Removed: 
    lldb/test/Shell/Reproducer/TestCrash.test
    lldb/test/Shell/Reproducer/TestFinalize.test


################################################################################
diff  --git a/lldb/test/Shell/Reproducer/TestCrash.test b/lldb/test/Shell/Reproducer/TestCrash.test
deleted file mode 100644
index 530dd8ad398d8..0000000000000
--- a/lldb/test/Shell/Reproducer/TestCrash.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# This tests that a reproducer is generated when LLDB crashes.
-
-# Start clean.
-# RUN: rm -rf %t.repro
-
-# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGSEGV' | FileCheck %s
-# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGILL' | FileCheck %s
-
-# CHECK: ********************
-# CHECK: Crash reproducer for
-# CHECK: Reproducer written to
-# CHECK: ********************
-
-# RUN: %lldb -b --capture --capture-path %t.repro --reproducer-no-generate-on-signal -o 'reproducer xcrash -s SIGSEGV' | FileCheck %s --check-prefix NOHANDLER
-
-# NOHANDLER-NOT: Crash reproducer
-# NOHANDLER-NOT: Reproducer written

diff  --git a/lldb/test/Shell/Reproducer/TestFinalize.test b/lldb/test/Shell/Reproducer/TestFinalize.test
deleted file mode 100644
index 4bfe82b56f171..0000000000000
--- a/lldb/test/Shell/Reproducer/TestFinalize.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# RUN: mkdir -p %t.repro
-# RUN: touch %t.known.file
-# RUN: mkdir -p %t.known.dir
-# RUN: touch %t.repro/index.yaml
-# RUN: echo -n "%t.known.file" > %t.repro/files.txt
-# RUN: echo -n "%t.known.dir" > %t.repro/dirs.txt
-
-# RUN: %lldb --reproducer-finalize %t.repro 2>&1 | FileCheck %s
-# CHECK-NOT: error
-# CHECK: Reproducer written to
-
-# RUN: echo "CHECK-DAG: %t.known.file" > %t.filecheck
-# RUN: echo "CHECK-DAG %t.known.dir" >> %t.filecheck
-# RUN: cat %t.repro/files.yaml | FileCheck %t.filecheck

diff  --git a/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test b/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
index 683a7e2f55297..8a6b03c4e22d7 100644
--- a/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
+++ b/lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
@@ -13,11 +13,6 @@
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
 # RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
 
-# Test crash reproducer.
-# RUN: rm -rf %t.repro
-# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCrashCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
-# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
-
 # CHECK: Breakpoint 1
 # CHECK: Process {{.*}} stopped
 # CHECK: Process {{.*}} launched

diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 977cc306bb4e6..86a74ae285e80 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -736,31 +736,6 @@ static void printHelp(LLDBOptTable &table, llvm::StringRef tool_name) {
 
 static llvm::Optional<int> InitializeReproducer(llvm::StringRef argv0,
                                                 opt::InputArgList &input_args) {
-  if (auto *finalize_path = input_args.getLastArg(OPT_reproducer_finalize)) {
-    if (const char *error = SBReproducer::Finalize(finalize_path->getValue())) {
-      WithColor::error() << "reproducer finalization failed: " << error << '\n';
-      return 1;
-    }
-
-    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()
-        << " - 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() << argv0 << " -replay " << finalize_path->getValue() << "\n";
-    llvm::outs() << "********************\n";
-    return 0;
-  }
-
   if (auto *replay_path = input_args.getLastArg(OPT_replay)) {
     SBReplayOptions replay_options;
     replay_options.SetCheckVersion(!input_args.hasArg(OPT_no_version_check));
@@ -799,18 +774,6 @@ static llvm::Optional<int> InitializeReproducer(llvm::StringRef argv0,
     }
     if (generate_on_exit)
       SBReproducer::SetAutoGenerate(true);
-
-    // Register the reproducer signal handler.
-    if (!input_args.hasArg(OPT_no_generate_on_signal)) {
-      if (const char *reproducer_path = SBReproducer::GetPath()) {
-        static std::string *finalize_cmd = new std::string(argv0);
-        finalize_cmd->append(" --reproducer-finalize '");
-        finalize_cmd->append(reproducer_path);
-        finalize_cmd->append("'");
-        llvm::sys::AddSignalHandler(reproducer_handler,
-                                    const_cast<char *>(finalize_cmd->c_str()));
-      }
-    }
   }
 
   return llvm::None;

diff  --git a/lldb/tools/driver/Options.td b/lldb/tools/driver/Options.td
index d59ac314d5944..3d29746740378 100644
--- a/lldb/tools/driver/Options.td
+++ b/lldb/tools/driver/Options.td
@@ -236,8 +236,6 @@ def capture_path: Separate<["--", "-"], "capture-path">,
 def replay: Separate<["--", "-"], "replay">,
   MetaVarName<"<filename>">,
   HelpText<"Tells the debugger to replay a reproducer from <filename>.">;
-def reproducer_finalize: Separate<["--", "-"], "reproducer-finalize">,
-  MetaVarName<"<filename>">;
 def no_version_check: F<"reproducer-no-version-check">,
   HelpText<"Disable the reproducer version check.">;
 def no_verification: F<"reproducer-no-verify">,


        


More information about the lldb-commits mailing list