+++ /dev/null
-# 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
+++ /dev/null
-# 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
# 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
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));
}
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;
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">,