summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-04-24 21:29:08 +0000
committerEnrico Granata <egranata@apple.com>2013-04-24 21:29:08 +0000
commite743c78299bb8034c7148e45d69a978af1e30656 (patch)
tree865801528fbb124f0e1d35c4fcf67aa03c896455 /lldb/source/Core/Debugger.cpp
parent2ad6691be440e88e3719c73ba49c99239ab1d230 (diff)
downloadbcm5719-llvm-e743c78299bb8034c7148e45d69a978af1e30656.tar.gz
bcm5719-llvm-e743c78299bb8034c7148e45d69a978af1e30656.zip
<rdar://problem/13209140>
“plugin load” tries to be more helpful when it fails to load a plugin llvm-svn: 180218
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index f442aa6073d..42a1540986e 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -344,20 +344,32 @@ Debugger::SettingsTerminate ()
}
bool
-Debugger::LoadPlugin (const FileSpec& spec)
+Debugger::LoadPlugin (const FileSpec& spec, Error& error)
{
lldb::DynamicLibrarySP dynlib_sp(new lldb_private::DynamicLibrary(spec));
+ if (!dynlib_sp || dynlib_sp->IsValid() == false)
+ {
+ 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);
// 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;
+ }
if (init_func(debugger_sb))
{
m_loaded_plugins.push_back(dynlib_sp);
return true;
}
+ error.SetErrorString("dylib refused to be loaded");
return false;
}
@@ -392,7 +404,8 @@ LoadPluginCallback
if (plugin_file_spec.GetFileNameExtension() != g_dylibext)
return FileSpec::eEnumerateDirectoryResultNext;
- debugger->LoadPlugin (plugin_file_spec);
+ Error plugin_load_error;
+ debugger->LoadPlugin (plugin_file_spec, plugin_load_error);
return FileSpec::eEnumerateDirectoryResultNext;
}
OpenPOWER on IntegriCloud