summaryrefslogtreecommitdiffstats
path: root/lldb/tools
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools')
-rw-r--r--lldb/tools/driver/Driver.cpp37
-rw-r--r--lldb/tools/driver/Options.td10
-rw-r--r--lldb/tools/lldb-server/SystemInitializerLLGS.cpp9
-rw-r--r--lldb/tools/lldb-server/SystemInitializerLLGS.h4
-rw-r--r--lldb/tools/lldb-server/lldb-server.cpp5
-rw-r--r--lldb/tools/lldb-test/SystemInitializerTest.cpp8
-rw-r--r--lldb/tools/lldb-test/SystemInitializerTest.h2
-rw-r--r--lldb/tools/lldb-test/lldb-test.cpp9
8 files changed, 53 insertions, 31 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<["--"], "">;
diff --git a/lldb/tools/lldb-server/SystemInitializerLLGS.cpp b/lldb/tools/lldb-server/SystemInitializerLLGS.cpp
index aeaf382a1dd..93ef4d9d076 100644
--- a/lldb/tools/lldb-server/SystemInitializerLLGS.cpp
+++ b/lldb/tools/lldb-server/SystemInitializerLLGS.cpp
@@ -22,9 +22,14 @@ using HostObjectFile = ObjectFileELF;
using namespace lldb_private;
-void SystemInitializerLLGS::Initialize() {
- SystemInitializerCommon::Initialize();
+llvm::Error
+SystemInitializerLLGS::Initialize(const InitializerOptions &options) {
+ if (auto e = SystemInitializerCommon::Initialize(options))
+ return e;
+
HostObjectFile::Initialize();
+
+ return llvm::Error::success();
}
void SystemInitializerLLGS::Terminate() {
diff --git a/lldb/tools/lldb-server/SystemInitializerLLGS.h b/lldb/tools/lldb-server/SystemInitializerLLGS.h
index e6460a2cdd3..7feba3fe07b 100644
--- a/lldb/tools/lldb-server/SystemInitializerLLGS.h
+++ b/lldb/tools/lldb-server/SystemInitializerLLGS.h
@@ -10,11 +10,13 @@
#ifndef LLDB_SYSTEMINITIALIZERLLGS_H
#define LLDB_SYSTEMINITIALIZERLLGS_H
+#include "lldb/Initialization/SystemInitializer.h"
#include "lldb/Initialization/SystemInitializerCommon.h"
class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon {
public:
- void Initialize() override;
+ llvm::Error
+ Initialize(const lldb_private::InitializerOptions &options) override;
void Terminate() override;
};
diff --git a/lldb/tools/lldb-server/lldb-server.cpp b/lldb/tools/lldb-server/lldb-server.cpp
index f05c96cfaa9..c924fa22f31 100644
--- a/lldb/tools/lldb-server/lldb-server.cpp
+++ b/lldb/tools/lldb-server/lldb-server.cpp
@@ -38,8 +38,9 @@ int main_gdbserver(int argc, char *argv[]);
int main_platform(int argc, char *argv[]);
static void initialize() {
- g_debugger_lifetime->Initialize(llvm::make_unique<SystemInitializerLLGS>(),
- nullptr);
+ if (auto e = g_debugger_lifetime->Initialize(
+ llvm::make_unique<SystemInitializerLLGS>(), {}, nullptr))
+ llvm::consumeError(std::move(e));
}
static void terminate() { g_debugger_lifetime->Terminate(); }
diff --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index 750f9c3d5cf..8f549bcd1d0 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -111,8 +111,10 @@ SystemInitializerTest::SystemInitializerTest() {}
SystemInitializerTest::~SystemInitializerTest() {}
-void SystemInitializerTest::Initialize() {
- SystemInitializerCommon::Initialize();
+llvm::Error
+SystemInitializerTest::Initialize(const InitializerOptions &options) {
+ if (auto e = SystemInitializerCommon::Initialize(options))
+ return e;
ObjectFileELF::Initialize();
ObjectFileMachO::Initialize();
@@ -231,6 +233,8 @@ void SystemInitializerTest::Initialize() {
// AFTER PluginManager::Initialize is called.
Debugger::SettingsInitialize();
+
+ return llvm::Error::success();
}
void SystemInitializerTest::Terminate() {
diff --git a/lldb/tools/lldb-test/SystemInitializerTest.h b/lldb/tools/lldb-test/SystemInitializerTest.h
index 887d6243765..5950ff725ff 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.h
+++ b/lldb/tools/lldb-test/SystemInitializerTest.h
@@ -26,7 +26,7 @@ public:
SystemInitializerTest();
~SystemInitializerTest() override;
- void Initialize() override;
+ llvm::Error Initialize(const InitializerOptions &options) override;
void Terminate() override;
};
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp
index 631e6a5dd1e..25ee16886e5 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -934,8 +934,13 @@ int main(int argc, const char *argv[]) {
cl::ParseCommandLineOptions(argc, argv, "LLDB Testing Utility\n");
SystemLifetimeManager DebuggerLifetime;
- DebuggerLifetime.Initialize(llvm::make_unique<SystemInitializerTest>(),
- nullptr);
+ if (auto e = DebuggerLifetime.Initialize(
+ llvm::make_unique<SystemInitializerTest>(), {}, nullptr)) {
+ WithColor::error() << "initialization failed: " << toString(std::move(e))
+ << '\n';
+ return 1;
+ }
+
CleanUp TerminateDebugger([&] { DebuggerLifetime.Terminate(); });
auto Dbg = lldb_private::Debugger::CreateInstance();
OpenPOWER on IntegriCloud