diff options
| author | Greg Clayton <gclayton@apple.com> | 2013-12-02 19:35:49 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2013-12-02 19:35:49 +0000 |
| commit | 5fb8f79738c57e474bee190555c3fca490f839e8 (patch) | |
| tree | 4199db27c6331f9dcbcdacd719dbe021fd497ea2 /lldb/source/Core/Debugger.cpp | |
| parent | 2c86a723313732097759b5fbbe2d58c9c33820cd (diff) | |
| download | bcm5719-llvm-5fb8f79738c57e474bee190555c3fca490f839e8.tar.gz bcm5719-llvm-5fb8f79738c57e474bee190555c3fca490f839e8.zip | |
Fixed internal code to not link against and code from "lldb/API/*".
lldb_private::Debugger was #including some "lldb/API" header files which causes tools (lldb-platform and lldb-gdbserver) that link against the internals only (no API layer) to fail to link depending on which calls were being used.
Also fixed the current working directory so that it gets set correctly for remote test suite runs. Now the remote working directory is set to: "ARCH/TESTNUM/..." where ARCH is the current architecture name and "TESTNUM" is the current test number.
Fixed the "lldb-platform" and "lldb-gdbserver" to not warn about mismatched visibility settings by having each have their own exports file which contains nothing. This forces all symbols to not be exported, and also quiets the linker warnings.
llvm-svn: 196141
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
| -rw-r--r-- | lldb/source/Core/Debugger.cpp | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 3941d82d47b..b57c6051a96 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -9,8 +9,6 @@ #include "lldb/lldb-python.h" -#include "lldb/API/SBDebugger.h" - #include "lldb/Core/Debugger.h" #include <map> @@ -46,6 +44,7 @@ #include "lldb/Target/TargetList.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/SectionLoadList.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" @@ -155,19 +154,7 @@ enum ePropertyAutoOneLineSummaries }; -// -//const char * -//Debugger::GetFrameFormat() const -//{ -// return m_properties_sp->GetFrameFormat(); -//} -//const char * -//Debugger::GetThreadFormat() const -//{ -// return m_properties_sp->GetThreadFormat(); -//} -// - +Debugger::LoadPluginCallbackType Debugger::g_load_plugin_callback = NULL; Error Debugger::SetPropertyValue (const ExecutionContext *exe_ctx, @@ -373,8 +360,9 @@ Debugger::TestDebuggerRefCount () } void -Debugger::Initialize () +Debugger::Initialize (LoadPluginCallbackType load_plugin_callback) { + g_load_plugin_callback = load_plugin_callback; if (g_shared_debugger_refcount++ == 0) lldb_private::Initialize(); } @@ -412,31 +400,22 @@ Debugger::SettingsTerminate () bool Debugger::LoadPlugin (const FileSpec& spec, Error& error) { - lldb::DynamicLibrarySP dynlib_sp(new lldb_private::DynamicLibrary(spec)); - if (!dynlib_sp || dynlib_sp->IsValid() == false) + if (g_load_plugin_callback) { - if (spec.Exists()) - error.SetErrorString("this file does not represent a loadable dylib"); - else - error.SetErrorString("no such file"); - return false; - } - lldb::DebuggerSP debugger_sp(shared_from_this()); - 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"); - if (!init_func) - { - error.SetErrorString("cannot find the initialization function lldb::PluginInitialize(lldb::SBDebugger)"); - return false; + lldb::DynamicLibrarySP dynlib_sp = g_load_plugin_callback (shared_from_this(), spec, error); + if (dynlib_sp) + { + m_loaded_plugins.push_back(dynlib_sp); + return true; + } } - if (init_func(debugger_sb)) + else { - m_loaded_plugins.push_back(dynlib_sp); - return true; + // The g_load_plugin_callback is registered in SBDebugger::Initialize() + // and if the public API layer isn't available (code is linking against + // all of the internal LLDB static libraries), then we can't load plugins + error.SetErrorString("Public API layer is not available"); } - error.SetErrorString("dylib refused to be loaded"); return false; } |

