summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectTarget.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-01-11 23:44:27 +0000
committerGreg Clayton <gclayton@apple.com>2013-01-11 23:44:27 +0000
commit91c0e749e36ea70935a2c6bf1d32d624ee51b980 (patch)
tree8b84e67b07efcd07d80f27c396d03958edb140bc /lldb/source/Commands/CommandObjectTarget.cpp
parent4e9a2dbde51fa5c6efc6dca4ee4d0296101ec676 (diff)
downloadbcm5719-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/Commands/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 1a6f3be79ce..badea458ae2 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -4272,7 +4272,24 @@ protected:
// current target, so we need to find that module in the
// target
ModuleList matching_module_list;
- const size_t num_matches = target->GetImages().FindModules (module_spec, matching_module_list);
+ size_t num_matches = target->GetImages().FindModules (module_spec, matching_module_list);
+ while (num_matches == 0)
+ {
+ ConstString filename_no_extension(module_spec.GetFileSpec().GetFileNameStrippingExtension());
+ // Empty string returned, lets bail
+ if (!filename_no_extension)
+ break;
+
+ // Check if there was no extension to strip and the basename is the same
+ if (filename_no_extension == module_spec.GetFileSpec().GetFilename())
+ break;
+
+ // Replace basename with one less extension
+ module_spec.GetFileSpec().GetFilename() = filename_no_extension;
+
+ num_matches = target->GetImages().FindModules (module_spec, matching_module_list);
+ }
+
if (num_matches > 1)
{
result.AppendErrorWithFormat ("multiple modules match symbol file '%s', use the --uuid option to resolve the ambiguity.\n", symfile_path);
@@ -4309,6 +4326,12 @@ protected:
ModuleList module_list;
module_list.Append (module_sp);
target->ModulesDidLoad (module_list);
+
+ // Make sure we load any scripting resources that may be embedded
+ // in the debug info files in case the platform supports that.
+ Error error;
+ module_sp->LoadScriptingResourceInTarget (target, error);
+
flush = true;
result.SetStatus (eReturnStatusSuccessFinishResult);
return true;
@@ -4317,7 +4340,6 @@ protected:
}
// Clear the symbol file spec if anything went wrong
module_sp->SetSymbolFileFileSpec (FileSpec());
-
}
if (module_spec.GetUUID().IsValid())
OpenPOWER on IntegriCloud