diff options
author | Greg Clayton <gclayton@apple.com> | 2013-01-11 23:44:27 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-01-11 23:44:27 +0000 |
commit | 91c0e749e36ea70935a2c6bf1d32d624ee51b980 (patch) | |
tree | 8b84e67b07efcd07d80f27c396d03958edb140bc /lldb/source/Core/Module.cpp | |
parent | 4e9a2dbde51fa5c6efc6dca4ee4d0296101ec676 (diff) | |
download | bcm5719-llvm-91c0e749e36ea70935a2c6bf1d32d624ee51b980.tar.gz bcm5719-llvm-91c0e749e36ea70935a2c6bf1d32d624ee51b980.zip |
<rdar://problem/12973809>
Fixed an issue with the auto loading of script resources in debug info files. Any platform can add support for this, and on MacOSX we allow dSYM files to contain python modules that get automatically loaded when a dSYM file is associated with an executable or shared library.
The modifications will now:
- Let the module locate the symbol file naturally instead of using a function that only works in certain cases. This helps us to locate the script resources as long as the dSYM file can be found.
- Don't try and do any of this if the script interpreter has scripting disabled.
- Allow more than one scripting resource to be found in a symbol file by returning the list
- Load the scripting resources when a symbol file is added via the "target symbols add" command.
- Be smarter about matching the dSYM mach-o file to an existing executable in the target images by stripping extensions on the symfile basname if needed.
llvm-svn: 172275
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r-- | lldb/source/Core/Module.cpp | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 69fccfc30f8..82abbaec557 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -1180,29 +1180,45 @@ Module::LoadScriptingResourceInTarget (Target *target, Error& error) return false; } - PlatformSP platform_sp(target->GetPlatform()); - - if (!platform_sp) + Debugger &debugger = target->GetDebugger(); + const ScriptLanguage script_language = debugger.GetScriptLanguage(); + if (script_language != eScriptLanguageNone) { - error.SetErrorString("invalid Platform"); - return false; - } + + PlatformSP platform_sp(target->GetPlatform()); + + if (!platform_sp) + { + error.SetErrorString("invalid Platform"); + return false; + } - ModuleSpec module_spec(GetFileSpec()); - FileSpec scripting_fspec = platform_sp->LocateExecutableScriptingResource(module_spec); - Debugger &debugger(target->GetDebugger()); - if (scripting_fspec && scripting_fspec.Exists()) - { ScriptInterpreter *script_interpreter = debugger.GetCommandInterpreter().GetScriptInterpreter(); if (script_interpreter) { - StreamString scripting_stream; - scripting_fspec.Dump(&scripting_stream); - const bool can_reload = false; - const bool init_lldb_globals = false; - bool did_load = script_interpreter->LoadScriptingModule(scripting_stream.GetData(), can_reload, init_lldb_globals, error); - if (!did_load) - return false; + FileSpecList file_specs = platform_sp->LocateExecutableScriptingResources (target, + *this); + + + const uint32_t num_specs = file_specs.GetSize(); + if (num_specs) + { + for (uint32_t i=0; i<num_specs; ++i) + { + FileSpec scripting_fspec (file_specs.GetFileSpecAtIndex(i)); + if (scripting_fspec && scripting_fspec.Exists()) + { + + StreamString scripting_stream; + scripting_fspec.Dump(&scripting_stream); + const bool can_reload = false; + const bool init_lldb_globals = false; + bool did_load = script_interpreter->LoadScriptingModule(scripting_stream.GetData(), can_reload, init_lldb_globals, error); + if (!did_load) + return false; + } + } + } } else { |