summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBSection.h3
-rw-r--r--lldb/include/lldb/API/SBTarget.h1
-rw-r--r--lldb/include/lldb/Target/PathMappingList.h6
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj7
-rw-r--r--lldb/scripts/Python/interface/SBSection.i3
-rw-r--r--lldb/source/API/SBSection.cpp17
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp98
7 files changed, 135 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBSection.h b/lldb/include/lldb/API/SBSection.h
index ed82f28c28b..d1b127f1729 100644
--- a/lldb/include/lldb/API/SBSection.h
+++ b/lldb/include/lldb/API/SBSection.h
@@ -47,6 +47,9 @@ public:
GetFileAddress ();
lldb::addr_t
+ GetLoadAddress (lldb::SBTarget &target);
+
+ lldb::addr_t
GetByteSize ();
uint64_t
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index c6f90ca1f6c..d8c45881a6d 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -741,6 +741,7 @@ protected:
friend class SBInstruction;
friend class SBModule;
friend class SBProcess;
+ friend class SBSection;
friend class SBSourceManager;
friend class SBSymbol;
friend class SBValue;
diff --git a/lldb/include/lldb/Target/PathMappingList.h b/lldb/include/lldb/Target/PathMappingList.h
index 8a7234bf5d2..a053cf348e0 100644
--- a/lldb/include/lldb/Target/PathMappingList.h
+++ b/lldb/include/lldb/Target/PathMappingList.h
@@ -57,6 +57,12 @@ public:
void
Dump (Stream *s, int pair_index=-1);
+ bool
+ IsEmpty() const
+ {
+ return m_pairs.empty();
+ }
+
size_t
GetSize () const
{
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index 59c2d90bcd2..5a0c0cafd0f 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -401,6 +401,7 @@
26C72C961243229A0068DC16 /* SBStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C72C951243229A0068DC16 /* SBStream.cpp */; };
26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 261B5A5311C3F2AD00AABD0A /* SharingPtr.h */; settings = {ATTRIBUTES = (Public, ); }; };
26D265BC136B4269002EEE45 /* lldb-public.h in Headers */ = {isa = PBXBuildFile; fileRef = 26651A14133BEC76005B64B7 /* lldb-public.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 26D55235159A7DB100708D8D /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26D55234159A7DB100708D8D /* libxml2.dylib */; };
26D5E15F135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */; };
26D5E163135BB054006EA0A7 /* OptionGroupPlatform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D5E162135BB054006EA0A7 /* OptionGroupPlatform.cpp */; };
26D7E45D13D5E30A007FD12B /* SocketAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D7E45C13D5E30A007FD12B /* SocketAddress.cpp */; };
@@ -1207,6 +1208,7 @@
26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverName.cpp; path = source/Breakpoint/BreakpointResolverName.cpp; sourceTree = "<group>"; };
26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ELFHeader.cpp; sourceTree = "<group>"; };
26D27C9E11ED3A4E0024D721 /* ELFHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELFHeader.h; sourceTree = "<group>"; };
+ 26D55234159A7DB100708D8D /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = ../../../../../../usr/lib/libxml2.dylib; sourceTree = "<group>"; };
26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupArchitecture.cpp; path = source/Interpreter/OptionGroupArchitecture.cpp; sourceTree = "<group>"; };
26D5E160135BAEB0006EA0A7 /* OptionGroupArchitecture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupArchitecture.h; path = include/lldb/Interpreter/OptionGroupArchitecture.h; sourceTree = "<group>"; };
26D5E161135BB040006EA0A7 /* OptionGroupPlatform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupPlatform.h; path = include/lldb/Interpreter/OptionGroupPlatform.h; sourceTree = "<group>"; };
@@ -1564,6 +1566,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 26D55235159A7DB100708D8D /* libxml2.dylib in Frameworks */,
268901161335BBC300698AC0 /* liblldb-core.a in Frameworks */,
2668022F115FD19D008E1FE4 /* CoreFoundation.framework in Frameworks */,
26680233115FD1A7008E1FE4 /* libobjc.dylib in Frameworks */,
@@ -1620,6 +1623,7 @@
08FB7794FE84155DC02AAC07 /* lldb */ = {
isa = PBXGroup;
children = (
+ 26D55234159A7DB100708D8D /* libxml2.dylib */,
AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */,
AFF87C8C150FF680000E1742 /* com.apple.debugserver.applist.plist */,
AFF87C8A150FF677000E1742 /* com.apple.debugserver.applist.plist */,
@@ -4367,6 +4371,7 @@
);
GCC_ENABLE_OBJC_GC = supported;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
@@ -4396,6 +4401,7 @@
);
GCC_ENABLE_OBJC_GC = supported;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
@@ -4425,6 +4431,7 @@
);
GCC_ENABLE_OBJC_GC = supported;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
diff --git a/lldb/scripts/Python/interface/SBSection.i b/lldb/scripts/Python/interface/SBSection.i
index 95838755c59..1ee908a9fc6 100644
--- a/lldb/scripts/Python/interface/SBSection.i
+++ b/lldb/scripts/Python/interface/SBSection.i
@@ -66,6 +66,9 @@ public:
GetFileAddress ();
lldb::addr_t
+ GetLoadAddress (lldb::SBTarget &target);
+
+ lldb::addr_t
GetByteSize ();
uint64_t
diff --git a/lldb/source/API/SBSection.cpp b/lldb/source/API/SBSection.cpp
index 24b94a7a53a..06a08d865f4 100644
--- a/lldb/source/API/SBSection.cpp
+++ b/lldb/source/API/SBSection.cpp
@@ -9,6 +9,7 @@
#include "lldb/API/SBSection.h"
#include "lldb/API/SBStream.h"
+#include "lldb/API/SBTarget.h"
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
@@ -126,6 +127,22 @@ SBSection::GetFileAddress ()
}
lldb::addr_t
+SBSection::GetLoadAddress (lldb::SBTarget &sb_target)
+{
+ TargetSP target_sp(sb_target.GetSP());
+ if (target_sp)
+ {
+ SectionSP section_sp (GetSP());
+ if (section_sp)
+ return section_sp->GetLoadBaseAddress(target_sp.get());
+ }
+ return LLDB_INVALID_ADDRESS;
+
+}
+
+
+
+lldb::addr_t
SBSection::GetByteSize ()
{
SectionSP section_sp (GetSP());
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 0b42bfbbebb..1d057f0cbf4 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -9,6 +9,10 @@
#include "SymbolVendorMacOSX.h"
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <string.h>
+
#include <AvailabilityMacros.h>
#include "lldb/Core/Module.h"
@@ -172,6 +176,100 @@ SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp)
dsym_objfile_sp = ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp);
if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get()))
{
+ char dsym_path[PATH_MAX];
+ if (module_sp->GetSourceMappingList().IsEmpty() && dsym_fspec.GetPath(dsym_path, sizeof(dsym_path)))
+ {
+ lldb_private::UUID dsym_uuid;
+ if (dsym_objfile_sp->GetUUID(&dsym_uuid))
+ {
+ char uuid_cstr_buf[64];
+ const char *uuid_cstr = dsym_uuid.GetAsCString (uuid_cstr_buf, sizeof(uuid_cstr_buf));
+ if (uuid_cstr)
+ {
+ char *resources = strstr (dsym_path, "/Contents/Resources/");
+ if (resources)
+ {
+ char dsym_uuid_plist_path[PATH_MAX];
+ resources[strlen("/Contents/Resources/")] = '\0';
+ snprintf(dsym_uuid_plist_path, sizeof(dsym_uuid_plist_path), "%s%s.plist", dsym_path, uuid_cstr);
+ FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path, false);
+ if (dsym_uuid_plist_spec.Exists())
+ {
+ xmlDoc *doc = ::xmlReadFile (dsym_uuid_plist_path, NULL, 0);
+ if (doc)
+ {
+ char DBGBuildSourcePath[PATH_MAX];
+ char DBGSourcePath[PATH_MAX];
+ DBGBuildSourcePath[0] = '\0';
+ DBGSourcePath[0] = '\0';
+ for (xmlNode *node = doc->children; node; node = node ? node->next : NULL)
+ {
+ if (node->type == XML_ELEMENT_NODE)
+ {
+ if (node->name && strcmp((const char*)node->name, "plist") == 0)
+ {
+ xmlNode *dict_node = node->children;
+ while (dict_node && dict_node->type != XML_ELEMENT_NODE)
+ dict_node = dict_node->next;
+ if (dict_node && dict_node->name && strcmp((const char *)dict_node->name, "dict") == 0)
+ {
+ for (xmlNode *key_node = dict_node->children; key_node; key_node = key_node->next)
+ {
+ if (key_node && key_node->type == XML_ELEMENT_NODE && key_node->name)
+ {
+ if (strcmp((const char *)key_node->name, "key") == 0)
+ {
+ const char *key_name = (const char *)::xmlNodeGetContent(key_node);
+ if (strcmp(key_name, "DBGBuildSourcePath") == 0)
+ {
+ xmlNode *value_node = key_node->next;
+ while (value_node && value_node->type != XML_ELEMENT_NODE)
+ value_node = value_node->next;
+ if (strcmp((const char *)value_node->name, "string") == 0)
+ {
+ const char *node_content = (const char *)::xmlNodeGetContent(value_node);
+ if (node_content)
+ {
+ strncpy(DBGBuildSourcePath, node_content, sizeof(DBGBuildSourcePath));
+ }
+ }
+ key_node = value_node;
+ }
+ else if (strcmp(key_name, "DBGSourcePath") == 0)
+ {
+ xmlNode *value_node = key_node->next;
+ while (value_node && value_node->type != XML_ELEMENT_NODE)
+ value_node = value_node->next;
+ if (strcmp((const char *)value_node->name, "string") == 0)
+ {
+ const char *node_content = (const char *)::xmlNodeGetContent(value_node);
+ if (node_content)
+ {
+ strncpy(DBGSourcePath, node_content, sizeof(DBGSourcePath));
+ }
+ }
+ key_node = value_node;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ::xmlFreeDoc (doc);
+
+ if (DBGBuildSourcePath[0] && DBGSourcePath[0])
+ {
+ module_sp->GetSourceMappingList().Append (ConstString(DBGBuildSourcePath), ConstString(DBGSourcePath), true);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
ReplaceDSYMSectionsWithExecutableSections (obj_file, dsym_objfile_sp.get());
symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp);
return symbol_vendor;
OpenPOWER on IntegriCloud