summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/macosx/Symbols.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-02-26 05:51:37 +0000
committerGreg Clayton <gclayton@apple.com>2012-02-26 05:51:37 +0000
commitb9a01b3990ee0911c560939b8caa282e03b7f42d (patch)
treeda515ffdc0753faf5c08d615a08b30bbaa56dee9 /lldb/source/Host/macosx/Symbols.cpp
parenta640db900abcc49d5390192b2bcbd7760a9c3113 (diff)
downloadbcm5719-llvm-b9a01b3990ee0911c560939b8caa282e03b7f42d.tar.gz
bcm5719-llvm-b9a01b3990ee0911c560939b8caa282e03b7f42d.zip
Made a ModuleSpec class in Module.h which can specify a module using one or
more of the local path, platform path, associated symbol file, UUID, arch, object name and object offset. This allows many of the calls that were GetSharedModule to reduce the number of arguments that were used in a call to these functions. It also allows a module to be created with a ModuleSpec which allows many things to be specified prior to any accessors being called on the Module class itself. I was running into problems when adding support for "target symbol add" where you can specify a stand alone debug info file after debugging has started where I needed to specify the associated symbol file path and if I waited until after construction, the wrong symbol file had already been located. By using the ModuleSpec it allows us to construct a module with as little or as much information as needed and not have to change the parameter list. llvm-svn: 151476
Diffstat (limited to 'lldb/source/Host/macosx/Symbols.cpp')
-rw-r--r--lldb/source/Host/macosx/Symbols.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index 50161def0db..efd8fbb47ff 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -21,6 +21,7 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/Module.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/Endian.h"
@@ -286,9 +287,7 @@ LocateDSYMMachFileInDSYMBundle
static int
LocateMacOSXFilesUsingDebugSymbols
(
- const FileSpec *exec_fspec, // An executable path that may or may not be correct if UUID is specified
- const ArchSpec* arch, // Limit the search to files with this architecture if non-NULL
- const lldb_private::UUID *uuid, // Match the UUID value if non-NULL,
+ const ModuleSpec &module_spec,
FileSpec *out_exec_fspec, // If non-NULL, try and find the executable
FileSpec *out_dsym_fspec // If non-NULL try and find the debug symbol file
)
@@ -303,6 +302,9 @@ LocateMacOSXFilesUsingDebugSymbols
#if !defined (__arm__) // No DebugSymbols on the iOS devices
+ const UUID *uuid = module_spec.GetUUIDPtr();
+ const ArchSpec *arch = module_spec.GetArchitecturePtr();
+
if (uuid && uuid->IsValid())
{
// Try and locate the dSYM file using DebugSymbols first
@@ -330,7 +332,7 @@ LocateMacOSXFilesUsingDebugSymbols
if (module_uuid_ref.get())
{
CFCReleaser<CFURLRef> exec_url;
-
+ const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
if (exec_fspec)
{
char exec_cf_path[PATH_MAX];
@@ -450,8 +452,9 @@ LocateMacOSXFilesUsingDebugSymbols
}
static bool
-LocateDSYMInVincinityOfExecutable (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid, FileSpec &dsym_fspec)
+LocateDSYMInVincinityOfExecutable (const ModuleSpec &module_spec, FileSpec &dsym_fspec)
{
+ const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
if (exec_fspec)
{
char path[PATH_MAX];
@@ -466,7 +469,7 @@ LocateDSYMInVincinityOfExecutable (const FileSpec *exec_fspec, const ArchSpec* a
dsym_fspec.SetFile(path, false);
- if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, arch, uuid))
+ if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr()))
{
return true;
}
@@ -484,7 +487,7 @@ LocateDSYMInVincinityOfExecutable (const FileSpec *exec_fspec, const ArchSpec* a
strncat(path, ".dSYM/Contents/Resources/DWARF/", sizeof(path));
strncat(path, exec_fspec->GetFilename().AsCString(), sizeof(path));
dsym_fspec.SetFile(path, false);
- if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, arch, uuid))
+ if (dsym_fspec.Exists() && FileAtPathContainsArchAndUUID (dsym_fspec, module_spec.GetArchitecturePtr(), module_spec.GetUUIDPtr()))
return true;
else
{
@@ -510,8 +513,11 @@ LocateDSYMInVincinityOfExecutable (const FileSpec *exec_fspec, const ArchSpec* a
}
FileSpec
-Symbols::LocateExecutableObjectFile (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid)
+Symbols::LocateExecutableObjectFile (const ModuleSpec &module_spec)
{
+ const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
+ const ArchSpec *arch = module_spec.GetArchitecturePtr();
+ const UUID *uuid = module_spec.GetUUIDPtr();
Timer scoped_timer (__PRETTY_FUNCTION__,
"LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
@@ -519,16 +525,20 @@ Symbols::LocateExecutableObjectFile (const FileSpec *exec_fspec, const ArchSpec*
uuid);
FileSpec objfile_fspec;
- if (exec_fspec && FileAtPathContainsArchAndUUID (*exec_fspec, arch, uuid))
- objfile_fspec = *exec_fspec;
+ if (exec_fspec && FileAtPathContainsArchAndUUID (exec_fspec, arch, uuid))
+ objfile_fspec = exec_fspec;
else
- LocateMacOSXFilesUsingDebugSymbols (exec_fspec, arch, uuid, &objfile_fspec, NULL);
+ LocateMacOSXFilesUsingDebugSymbols (module_spec, &objfile_fspec, NULL);
return objfile_fspec;
}
FileSpec
-Symbols::LocateExecutableSymbolFile (const FileSpec *exec_fspec, const ArchSpec* arch, const lldb_private::UUID *uuid)
+Symbols::LocateExecutableSymbolFile (const ModuleSpec &module_spec)
{
+ const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
+ const ArchSpec *arch = module_spec.GetArchitecturePtr();
+ const UUID *uuid = module_spec.GetUUIDPtr();
+
Timer scoped_timer (__PRETTY_FUNCTION__,
"LocateExecutableSymbolFile (file = %s, arch = %s, uuid = %p)",
exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
@@ -538,10 +548,10 @@ Symbols::LocateExecutableSymbolFile (const FileSpec *exec_fspec, const ArchSpec*
FileSpec symbol_fspec;
// First try and find the dSYM in the same directory as the executable or in
// an appropriate parent directory
- if (LocateDSYMInVincinityOfExecutable (exec_fspec, arch, uuid, symbol_fspec) == false)
+ if (LocateDSYMInVincinityOfExecutable (module_spec, symbol_fspec) == false)
{
// We failed to easily find the dSYM above, so use DebugSymbols
- LocateMacOSXFilesUsingDebugSymbols (exec_fspec, arch, uuid, NULL, &symbol_fspec);
+ LocateMacOSXFilesUsingDebugSymbols (module_spec, NULL, &symbol_fspec);
}
return symbol_fspec;
}
OpenPOWER on IntegriCloud