diff options
author | Zachary Turner <zturner@google.com> | 2014-08-27 20:15:09 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-08-27 20:15:09 +0000 |
commit | 58a559c07e448570659b92de50ca22172fbe0508 (patch) | |
tree | c531c86e19e38d9e81e69355ddacc4dbc5f9458e /lldb/source/API/SBDebugger.cpp | |
parent | dfbe3d6b17b0038d61a2d4a05e6ac3185a81f4a3 (diff) | |
download | bcm5719-llvm-58a559c07e448570659b92de50ca22172fbe0508.tar.gz bcm5719-llvm-58a559c07e448570659b92de50ca22172fbe0508.zip |
Update LLDB to use LLVM's DynamicLibrary.
LLDB had implemented its own DynamicLibrary class for plugin
support. LLVM has an equivalent mechanism, so this patch deletes
the duplicated code in LLDB and updates LLDB to reference the
mechanism provided by LLVM.
llvm-svn: 216606
Diffstat (limited to 'lldb/source/API/SBDebugger.cpp')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 20d62b4f809..dae567525a4 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -38,13 +38,14 @@ #include "lldb/Core/State.h" #include "lldb/Core/StreamFile.h" #include "lldb/DataFormatters/DataVisualization.h" -#include "lldb/Host/DynamicLibrary.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionGroupPlatform.h" #include "lldb/Target/Process.h" #include "lldb/Target/TargetList.h" +#include "llvm/Support/DynamicLibrary.h" + using namespace lldb; using namespace lldb_private; @@ -72,22 +73,22 @@ SBInputReader::IsActive() const return false; } -static lldb::DynamicLibrarySP +static llvm::sys::DynamicLibrary LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& error) { - lldb::DynamicLibrarySP dynlib_sp(new lldb_private::DynamicLibrary(spec)); - if (dynlib_sp && dynlib_sp->IsValid()) + llvm::sys::DynamicLibrary dynlib = llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str()); + if (dynlib.isValid()) { typedef bool (*LLDBCommandPluginInit) (lldb::SBDebugger& debugger); lldb::SBDebugger debugger_sb(debugger_sp); // This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger) function. // TODO: mangle this differently for your system - on OSX, the first underscore needs to be removed and the second one stays - LLDBCommandPluginInit init_func = dynlib_sp->GetSymbol<LLDBCommandPluginInit>("_ZN4lldb16PluginInitializeENS_10SBDebuggerE"); + LLDBCommandPluginInit init_func = (LLDBCommandPluginInit)dynlib.getAddressOfSymbol("_ZN4lldb16PluginInitializeENS_10SBDebuggerE"); if (init_func) { if (init_func(debugger_sb)) - return dynlib_sp; + return dynlib; else error.SetErrorString("plug-in refused to load (lldb::PluginInitialize(lldb::SBDebugger) returned false)"); } @@ -103,7 +104,7 @@ LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& er else error.SetErrorString("no such file"); } - return lldb::DynamicLibrarySP(); + return llvm::sys::DynamicLibrary(); } void |