forked from OSchip/llvm-project
<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
This commit is contained in:
parent
a3606adf90
commit
103f02820d
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -33,6 +33,11 @@ public:
|
|||
lldb::ModuleSP &module_sp,
|
||||
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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue