[lldb] Remove --reproducer-finalize and associated functionality
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 17 Dec 2021 20:18:22 +0000 (12:18 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 17 Dec 2021 20:19:55 +0000 (12:19 -0800)
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

lldb/test/Shell/Reproducer/TestCrash.test [deleted file]
lldb/test/Shell/Reproducer/TestFinalize.test [deleted file]
lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
lldb/tools/driver/Driver.cpp
lldb/tools/driver/Options.td

diff --git a/lldb/test/Shell/Reproducer/TestCrash.test b/lldb/test/Shell/Reproducer/TestCrash.test
deleted file mode 100644 (file)
index 530dd8a..0000000
+++ /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 (file)
index 4bfe82b..0000000
+++ /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
index 683a7e2..8a6b03c 100644 (file)
 # 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
index 977cc30..86a74ae 100644 (file)
@@ -736,31 +736,6 @@ EXAMPLES:
 
 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;
index d59ac31..3d29746 100644 (file)
@@ -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">,