From 67bc2435359a8f09f607d6c3fc0a196bd496d31f Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 17 Dec 2021 12:18:22 -0800 Subject: [PATCH] [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 --- lldb/test/Shell/Reproducer/TestCrash.test | 17 ---------- lldb/test/Shell/Reproducer/TestFinalize.test | 14 -------- lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test | 5 --- lldb/tools/driver/Driver.cpp | 37 ---------------------- lldb/tools/driver/Options.td | 2 -- 5 files changed, 75 deletions(-) delete mode 100644 lldb/test/Shell/Reproducer/TestCrash.test delete mode 100644 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 530dd8a..0000000 --- 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 4bfe82b..0000000 --- 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 683a7e2..8a6b03c 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 977cc30..86a74ae 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -736,31 +736,6 @@ EXAMPLES: static llvm::Optional 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 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(finalize_cmd->c_str())); - } - } } return llvm::None; diff --git a/lldb/tools/driver/Options.td b/lldb/tools/driver/Options.td index d59ac31..3d29746 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<"">, HelpText<"Tells the debugger to replay a reproducer from .">; -def reproducer_finalize: Separate<["--", "-"], "reproducer-finalize">, - MetaVarName<"">; def no_version_check: F<"reproducer-no-version-check">, HelpText<"Disable the reproducer version check.">; def no_verification: F<"reproducer-no-verify">, -- 2.7.4