diff options
author | Greg Clayton <gclayton@apple.com> | 2012-09-12 02:03:59 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-09-12 02:03:59 +0000 |
commit | 103f02820d20fd880792d3f4c179aead198597d5 (patch) | |
tree | d3ba404eca84dd4d9e7761095b6e4d082867c879 /lldb | |
parent | a3606adf9072b1e0d34bf5f40e257a2c68e09222 (diff) | |
download | bcm5719-llvm-103f02820d20fd880792d3f4c179aead198597d5.tar.gz bcm5719-llvm-103f02820d20fd880792d3f4c179aead198597d5.zip |
<rdar://problem/11374963>
Partial fix for the above radar where we now resolve dsym mach-o files within the dSYM bundle when using "add-dsym" through the platform.
llvm-svn: 163676
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/include/lldb/Host/Symbols.h | 5 | ||||
-rw-r--r-- | lldb/include/lldb/Target/Platform.h | 53 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 11 | ||||
-rw-r--r-- | lldb/source/Host/common/Symbols.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Host/macosx/Symbols.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp | 28 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h | 5 | ||||
-rw-r--r-- | lldb/source/Target/Platform.cpp | 16 |
8 files changed, 131 insertions, 8 deletions
diff --git a/lldb/include/lldb/Host/Symbols.h b/lldb/include/lldb/Host/Symbols.h index 57f168e3bc0..7e997cc76cd 100644 --- a/lldb/include/lldb/Host/Symbols.h +++ b/lldb/include/lldb/Host/Symbols.h @@ -29,6 +29,11 @@ public: static FileSpec LocateExecutableSymbolFile (const ModuleSpec &module_spec); + + static FileSpec + FindSymbolFileInBundle (const FileSpec& dsym_bundle_fspec, + const lldb_private::UUID *uuid, + const ArchSpec *arch); }; } // namespace lldb_private diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index d72d1628d5f..89f6441de6b 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -118,6 +118,59 @@ namespace lldb_private { lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr); + + //------------------------------------------------------------------ + /// Find a symbol file given a symbol file module specification. + /// + /// Each platform might have tricks to find symbol files for an + /// executable given information in a symbol file ModuleSpec. Some + /// platforms might also support symbol files that are bundles and + /// know how to extract the right symbol file given a bundle. + /// + /// @param[in] target + /// The target in which we are trying to resolve the symbol file. + /// The target has a list of modules that we might be able to + /// use in order to help find the right symbol file. If the + /// "m_file" or "m_platform_file" entries in the \a sym_spec + /// are filled in, then we might be able to locate a module in + /// the target, extract its UUID and locate a symbol file. + /// If just the "m_uuid" is specified, then we might be able + /// to find the module in the target that matches that UUID + /// and pair the symbol file along with it. If just "m_symbol_file" + /// is specified, we can use a variety of tricks to locate the + /// symbols in an SDK, PDK, or other development kit location. + /// + /// @param[in] sym_spec + /// A module spec that describes some information about the + /// symbol file we are trying to resolve. The ModuleSpec might + /// contain the following: + /// m_file - A full or partial path to an executable from the + /// target (might be empty). + /// m_platform_file - Another executable hint that contains + /// the path to the file as known on the + /// local/remote platform. + /// m_symbol_file - A full or partial path to a symbol file + /// or symbol bundle that should be used when + /// trying to resolve the symbol file. + /// m_arch - The architecture we are looking for when resolving + /// the symbol file. + /// m_uuid - The UUID of the executable and symbol file. This + /// can often be used to match up an exectuable with + /// a symbol file, or resolve an symbol file in a + /// symbol file bundle. + /// + /// @param[out] sym_file + /// The resolved symbol file spec if the returned error + /// indicates succes. + /// + /// @return + /// Returns an error that describes success or failure. + //------------------------------------------------------------------ + virtual Error + ResolveSymbolFile (Target &target, + const ModuleSpec &sym_spec, + FileSpec &sym_file); + //------------------------------------------------------------------ /// Resolves the FileSpec to a (possibly) remote path. Remote /// platforms must override this to resolve to a path on the remote diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 90ac7615fe0..d29c8a19e6d 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -4040,12 +4040,21 @@ protected: } else { + PlatformSP platform_sp (target->GetPlatform()); + for (size_t i=0; i<argc; ++i) { const char *symfile_path = args.GetArgumentAtIndex(i); if (symfile_path) { - FileSpec symfile_spec(symfile_path, true); + ModuleSpec sym_spec; + FileSpec symfile_spec; + sym_spec.GetSymbolFileSpec().SetFile(symfile_path, true); + if (platform_sp) + platform_sp->ResolveSymbolFile(*target, sym_spec, symfile_spec); + else + symfile_spec.SetFile(symfile_path, true); + ArchSpec arch; if (symfile_spec.Exists()) { diff --git a/lldb/source/Host/common/Symbols.cpp b/lldb/source/Host/common/Symbols.cpp index a4e570332f7..464c2fc5784 100644 --- a/lldb/source/Host/common/Symbols.cpp +++ b/lldb/source/Host/common/Symbols.cpp @@ -28,4 +28,13 @@ Symbols::LocateExecutableSymbolFile (const ModuleSpec &module_spec) return FileSpec(); } +FileSpec +Symbols::FindSymbolFileInBundle (const FileSpec& symfile_bundle, + const lldb_private::UUID *uuid, + const ArchSpec *arch) +{ + return FileSpec(); +} + + #endif diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp index eb7341d6dad..c49592eddc7 100644 --- a/lldb/source/Host/macosx/Symbols.cpp +++ b/lldb/source/Host/macosx/Symbols.cpp @@ -244,12 +244,10 @@ FileAtPathContainsArchAndUUID return false; } -static FileSpec -LocateDSYMMachFileInDSYMBundle -( - const FileSpec& dsym_bundle_fspec, - const lldb_private::UUID *uuid, - const ArchSpec *arch) +FileSpec +Symbols::FindSymbolFileInBundle (const FileSpec& dsym_bundle_fspec, + const lldb_private::UUID *uuid, + const ArchSpec *arch) { char path[PATH_MAX]; @@ -361,7 +359,7 @@ LocateMacOSXFilesUsingDebugSymbols if (out_dsym_fspec->GetFileType () == FileSpec::eFileTypeDirectory) { - *out_dsym_fspec = LocateDSYMMachFileInDSYMBundle (*out_dsym_fspec, uuid, arch); + *out_dsym_fspec = Symbols::FindSymbolFileInBundle (*out_dsym_fspec, uuid, arch); if (*out_dsym_fspec) ++items_found; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index dc5658ba703..4d5c722260d 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/Host.h" +#include "lldb/Host/Symbols.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Target.h" @@ -170,6 +171,33 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file, return error; } +Error +PlatformDarwin::ResolveSymbolFile (Target &target, + const ModuleSpec &sym_spec, + FileSpec &sym_file) +{ + Error error; + sym_file = sym_spec.GetSymbolFileSpec(); + if (sym_file.Exists()) + { + if (sym_file.GetFileType() == FileSpec::eFileTypeDirectory) + { + sym_file = Symbols::FindSymbolFileInBundle (sym_file, + sym_spec.GetUUIDPtr(), + sym_spec.GetArchitecturePtr()); + } + } + else + { + if (sym_spec.GetUUID().IsValid()) + { + + } + } + return error; + +} + Error diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h index 3c27d43a526..9376a660bcc 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -34,6 +34,11 @@ public: const lldb_private::FileSpecList *module_search_paths_ptr); virtual lldb_private::Error + ResolveSymbolFile (lldb_private::Target &target, + const lldb_private::ModuleSpec &sym_spec, + lldb_private::FileSpec &sym_file); + + virtual lldb_private::Error GetSharedModule (const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 666daaa651d..6772abf00be 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -466,6 +466,22 @@ Platform::ResolveExecutable (const FileSpec &exe_file, return error; } +Error +Platform::ResolveSymbolFile (Target &target, + const ModuleSpec &sym_spec, + FileSpec &sym_file) +{ + Error error; + if (sym_spec.GetSymbolFileSpec().Exists()) + sym_file = sym_spec.GetSymbolFileSpec(); + else + error.SetErrorString("unable to resolve symbol file"); + return error; + +} + + + bool Platform::ResolveRemotePath (const FileSpec &platform_path, FileSpec &resolved_platform_path) |