diff options
Diffstat (limited to 'lldb/tools/driver')
-rw-r--r-- | lldb/tools/driver/Driver.cpp | 37 | ||||
-rw-r--r-- | lldb/tools/driver/Options.td | 10 |
2 files changed, 26 insertions, 21 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 637103088b1..cd61cf66833 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -367,21 +367,6 @@ SBError Driver::ProcessArgs(const opt::InputArgList &args, bool &exiting) { m_option_data.m_debug_mode = true; } - if (auto *arg = args.getLastArg(OPT_reproducer)) { - auto arg_value = arg->getValue(); - SBFileSpec file(arg_value); - if (file.Exists()) { - SBError repro_error = m_debugger.ReplayReproducer(arg_value); - if (repro_error.Fail()) - return repro_error; - } else { - error.SetErrorStringWithFormat("file specified in --reproducer " - "(-z) option doesn't exist: '%s'", - arg_value); - return error; - } - } - if (args.hasArg(OPT_no_use_colors)) { m_debugger.SetUseColor(false); } @@ -942,7 +927,27 @@ main(int argc, char const *argv[]) << '\n'; } - SBDebugger::Initialize(); + SBInitializerOptions options; + + if (auto *arg = input_args.getLastArg(OPT_capture)) { + auto arg_value = arg->getValue(); + options.SetReproducerPath(arg_value); + options.SetCaptureReproducer(true); + } + + if (auto *arg = input_args.getLastArg(OPT_replay)) { + auto arg_value = arg->getValue(); + options.SetReplayReproducer(true); + options.SetReproducerPath(arg_value); + } + + SBError error = SBDebugger::Initialize(options); + if (error.Fail()) { + WithColor::error() << "initialization failed: " << error.GetCString() + << '\n'; + return 1; + } + SBHostOS::ThreadCreated("<lldb.driver.main-thread>"); signal(SIGINT, sigint_handler); diff --git a/lldb/tools/driver/Options.td b/lldb/tools/driver/Options.td index 90df963325a..4a2ddfeefa3 100644 --- a/lldb/tools/driver/Options.td +++ b/lldb/tools/driver/Options.td @@ -209,11 +209,11 @@ def: Flag<["-"], "d">, Alias<debug>, HelpText<"Alias for --debug">; -def reproducer: Separate<["--", "-"], "reproducer">, +def capture: Separate<["--", "-"], "capture">, MetaVarName<"<filename>">, - HelpText<"Tells the debugger to use the fullpath to <filename> as a reproducer.">; -def: Separate<["-"], "z">, - Alias<file>, - HelpText<"Alias for --reproducer">; + HelpText<"Tells the debugger to capture a reproducer to <filename>.">; +def replay: Separate<["--", "-"], "replay">, + MetaVarName<"<filename>">, + HelpText<"Tells the debugger to replay a reproducer from <filename>.">; def REM : R<["--"], "">; |