[Lldb-commits] [lldb] r159391 - in /lldb/branches/lldb-platform-work: ./ examples/python/ include/lldb/API/ include/lldb/Target/ lldb.xcodeproj/ scripts/Python/interface/ source/API/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolVendor/MacOSX/ source/Target/ tools/debugserver/source/MacOSX/arm/

Johnny Chen johnny.chen at apple.com
Thu Jun 28 16:25:40 PDT 2012


Author: johnny
Date: Thu Jun 28 18:25:40 2012
New Revision: 159391

URL: http://llvm.org/viewvc/llvm-project?rev=159391&view=rev
Log:
Merge changes from ToT trunk.
Plus add '-lxml2' to the "Other Linker Flags" section for lldb-platform in order to build.

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/examples/python/crashlog.py
    lldb/branches/lldb-platform-work/examples/python/symbolication.py
    lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h
    lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h
    lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h
    lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
    lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i
    lldb/branches/lldb-platform-work/source/API/SBSection.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
    lldb/branches/lldb-platform-work/source/Target/PathMappingList.cpp
    lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 28 18:25:40 2012
@@ -1 +1 @@
-/lldb/trunk:154223-159291
+/lldb/trunk:154223-159373

Modified: lldb/branches/lldb-platform-work/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/crashlog.py?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/crashlog.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/crashlog.py Thu Jun 28 18:25:40 2012
@@ -469,7 +469,7 @@
         if crash_log.error:
             print crash_log.error
             continue
-        if options.verbose:
+        if options.debug:
             crash_log.dump()
         if not crash_log.images:
             print 'error: no images in crash log "%s"' % (crash_log)
@@ -570,7 +570,7 @@
     if crash_log.error:
         print crash_log.error
         return
-    if options.verbose:
+    if options.debug:
         crash_log.dump()
     if not crash_log.images:
         print 'error: no images in crash log'
@@ -616,10 +616,10 @@
         for frame_idx, frame in enumerate(thread.frames):
             disassemble = (this_thread_crashed or options.disassemble_all_threads) and frame_idx < options.disassemble_depth;
             if frame_idx == 0:
-                symbolicated_frame_addresses = crash_log.symbolicate (frame.pc)
+                symbolicated_frame_addresses = crash_log.symbolicate (frame.pc, options.verbose)
             else:
                 # Any frame above frame zero and we have to subtract one to get the previous line entry
-                symbolicated_frame_addresses = crash_log.symbolicate (frame.pc - 1)
+                symbolicated_frame_addresses = crash_log.symbolicate (frame.pc - 1, options.verbose)
             
             if symbolicated_frame_addresses:
                 symbolicated_frame_address_idx = 0
@@ -651,9 +651,10 @@
     usage = "usage: %prog [options] <FILE> [FILE ...]"
     option_parser = optparse.OptionParser(description=description, prog='crashlog',usage=usage)
     option_parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
+    option_parser.add_option('-g', '--debug', action='store_true', dest='debug', help='display verbose debug logging', default=False)
     option_parser.add_option('-a', '--load-all', action='store_true', dest='load_all_images', help='load all executable images, not just the images found in the crashed stack frames', default=False)
     option_parser.add_option('--images', action='store_true', dest='dump_image_list', help='show image list', default=False)
-    option_parser.add_option('-g', '--debug-delay', type='int', dest='debug_delay', metavar='NSEC', help='pause for NSEC seconds for debugger', default=0)
+    option_parser.add_option('--debug-delay', type='int', dest='debug_delay', metavar='NSEC', help='pause for NSEC seconds for debugger', default=0)
     option_parser.add_option('-c', '--crashed-only', action='store_true', dest='crashed_only', help='only symbolicate the crashed thread', default=False)
     option_parser.add_option('-d', '--disasm-depth', type='int', dest='disassemble_depth', help='set the depth in stack frames that should be disassembled (default is 1)', default=1)
     option_parser.add_option('-D', '--disasm-all', action='store_true', dest='disassemble_all_threads', help='enabled disassembly of frames on all threads (not just the crashed thread)', default=False)
@@ -678,7 +679,7 @@
     except:
         return
         
-    if options.verbose:
+    if options.debug:
         print 'command_args = %s' % command_args
         print 'options', options
         print 'args', args

Modified: lldb/branches/lldb-platform-work/examples/python/symbolication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/examples/python/symbolication.py?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/examples/python/symbolication.py (original)
+++ lldb/branches/lldb-platform-work/examples/python/symbolication.py Thu Jun 28 18:25:40 2012
@@ -83,7 +83,7 @@
             return sym_ctx.GetSymbol().GetInstructions(self.target)
         return None
     
-    def symbolicate(self):
+    def symbolicate(self, verbose = False):
         if self.symbolication == None:
             self.symbolication = ''
             self.inlined = False
@@ -91,7 +91,11 @@
             if sym_ctx:
                 module = sym_ctx.GetModule()
                 if module:
-                    self.symbolication += module.GetFileSpec().GetFilename() + '`'
+                    # Print full source file path in verbose mode
+                    if verbose:
+                        self.symbolication += str(module.GetFileSpec()) + '`'
+                    else:
+                        self.symbolication += module.GetFileSpec().GetFilename() + '`'
                     function_start_load_addr = -1
                     function = sym_ctx.GetFunction()
                     block = sym_ctx.GetBlock()
@@ -126,11 +130,15 @@
 
                     # Print out any line information if any is available
                     if line_entry.GetFileSpec():
+                        # Print full source file path in verbose mode
+                        if verbose:
+                            self.symbolication += ' at %s' % line_entry.GetFileSpec()
+                        else:
                             self.symbolication += ' at %s' % line_entry.GetFileSpec().GetFilename()
-                            self.symbolication += ':%u' % line_entry.GetLine ()
-                            column = line_entry.GetColumn()
-                            if column > 0:
-                                self.symbolication += ':%u' % column
+                        self.symbolication += ':%u' % line_entry.GetLine ()
+                        column = line_entry.GetColumn()
+                        if column > 0:
+                            self.symbolication += ':%u' % column
                     return True
         return False
 
@@ -393,7 +401,7 @@
                     return self.target
         return None
     
-    def symbolicate(self, load_addr):
+    def symbolicate(self, load_addr, verbose = False):
         if not self.target:
             self.create_target()
         if self.target:
@@ -401,7 +409,7 @@
             if image:
                 image.add_module (self.target)
                 symbolicated_address = Address(self.target, load_addr)
-                if symbolicated_address.symbolicate ():
+                if symbolicated_address.symbolicate (verbose):
             
                     if symbolicated_address.so_addr:
                         symbolicated_addresses = list()
@@ -418,7 +426,7 @@
                             symbolicated_address = Address(self.target, inlined_parent_so_addr.GetLoadAddress(self.target))
                             symbolicated_address.sym_ctx = inlined_parent_sym_ctx
                             symbolicated_address.so_addr = inlined_parent_so_addr
-                            symbolicated_address.symbolicate ()
+                            symbolicated_address.symbolicate (verbose)
                 
                             # push the new frame onto the new frame stack
                             symbolicated_addresses.append (symbolicated_address)
@@ -532,7 +540,7 @@
     if target:
         for addr_str in args:
             addr = int(addr_str, 0)
-            symbolicated_addrs = symbolicator.symbolicate(addr)
+            symbolicated_addrs = symbolicator.symbolicate(addr, options.verbose)
             for symbolicated_addr in symbolicated_addrs:
                 print symbolicated_addr
             print

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBSection.h Thu Jun 28 18:25:40 2012
@@ -47,6 +47,9 @@
     GetFileAddress ();
 
     lldb::addr_t
+    GetLoadAddress (lldb::SBTarget &target);
+    
+    lldb::addr_t
     GetByteSize ();
 
     uint64_t

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBTarget.h Thu Jun 28 18:25:40 2012
@@ -741,6 +741,7 @@
     friend class SBInstruction;
     friend class SBModule;
     friend class SBProcess;
+    friend class SBSection;
     friend class SBSourceManager;
     friend class SBSymbol;
     friend class SBValue;

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/PathMappingList.h Thu Jun 28 18:25:40 2012
@@ -57,6 +57,12 @@
     void
     Dump (Stream *s, int pair_index=-1);
 
+    bool
+    IsEmpty() const
+    {
+        return m_pairs.empty();
+    }
+
     size_t
     GetSize () const
     {

Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Thu Jun 28 18:25:40 2012
@@ -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 */; };
@@ -1218,6 +1219,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 = "<absolute>"; };
 		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>"; };
@@ -1579,6 +1581,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 */,
@@ -1635,16 +1638,11 @@
 		08FB7794FE84155DC02AAC07 /* lldb */ = {
 			isa = PBXGroup;
 			children = (
-				AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */,
-				AFF87C8C150FF680000E1742 /* com.apple.debugserver.applist.plist */,
-				AFF87C8A150FF677000E1742 /* com.apple.debugserver.applist.plist */,
-				AFF87C88150FF672000E1742 /* com.apple.debugserver-secure.plist */,
-				AFF87C86150FF669000E1742 /* com.apple.debugserver.plist */,
 				26F5C32810F3DF7D009D5894 /* Libraries */,
+				264E8576159BE51A00E9D7A2 /* Resources */,
 				08FB7795FE84155DC02AAC07 /* Source */,
 				26F5C22410F3D950009D5894 /* Tools */,
 				1AB674ADFE9D54B511CA2CBB /* Products */,
-				2689FFCA13353D7A00698AC0 /* liblldb-core.a */,
 			);
 			name = lldb;
 			sourceTree = "<group>";
@@ -2104,6 +2102,18 @@
 			name = "GDB Server";
 			sourceTree = "<group>";
 		};
+		264E8576159BE51A00E9D7A2 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */,
+				AFF87C8C150FF680000E1742 /* com.apple.debugserver.applist.plist */,
+				AFF87C8A150FF677000E1742 /* com.apple.debugserver.applist.plist */,
+				AFF87C88150FF672000E1742 /* com.apple.debugserver-secure.plist */,
+				AFF87C86150FF669000E1742 /* com.apple.debugserver.plist */,
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
 		26579F55126A255E0007C5CB /* darwin-debug */ = {
 			isa = PBXGroup;
 			children = (
@@ -3009,9 +3019,11 @@
 				265ABF6210F42EE900531910 /* DebugSymbols.framework */,
 				260C876910F538E700BB2B04 /* Foundation.framework */,
 				26F5C32A10F3DFDD009D5894 /* libedit.dylib */,
+				2689FFCA13353D7A00698AC0 /* liblldb-core.a */,
 				26F5C37410F3F61B009D5894 /* libobjc.dylib */,
 				26F5C32410F3DF23009D5894 /* libpython.dylib */,
 				26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */,
+				26D55234159A7DB100708D8D /* libxml2.dylib */,
 				4C74CB6212288704006A8171 /* Carbon.framework */,
 				EDB919B414F6F10D008FF64B /* Security.framework */,
 			);
@@ -4404,6 +4416,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;
@@ -4433,6 +4446,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;
@@ -4462,6 +4476,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;
@@ -4738,6 +4753,7 @@
 				OTHER_LDFLAGS = (
 					"-lllvmclang",
 					"-lpython",
+					"-lxml2",
 					"-framework",
 					DebugSymbols,
 					"-framework",
@@ -4797,6 +4813,7 @@
 				OTHER_LDFLAGS = (
 					"-lllvmclang",
 					"-lpython",
+					"-lxml2",
 					"-framework",
 					DebugSymbols,
 					"-framework",
@@ -4857,6 +4874,7 @@
 				OTHER_LDFLAGS = (
 					"-lllvmclang",
 					"-lpython",
+					"-lxml2",
 					"-framework",
 					DebugSymbols,
 					"-framework",

Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBSection.i Thu Jun 28 18:25:40 2012
@@ -66,6 +66,9 @@
     GetFileAddress ();
 
     lldb::addr_t
+    GetLoadAddress (lldb::SBTarget &target);
+    
+    lldb::addr_t
     GetByteSize ();
 
     uint64_t

Modified: lldb/branches/lldb-platform-work/source/API/SBSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBSection.cpp?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBSection.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBSection.cpp Thu Jun 28 18:25:40 2012
@@ -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 @@
 }
 
 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());

Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Jun 28 18:25:40 2012
@@ -761,7 +761,7 @@
     }
     else
     {
-        error_str.assign ("failed to send the qLaunchSuccess packet");
+        error_str.assign ("timed out waiting for app to launch");
     }
     return false;
 }

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Thu Jun 28 18:25:40 2012
@@ -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 @@
                 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;

Modified: lldb/branches/lldb-platform-work/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/PathMappingList.cpp?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/PathMappingList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/PathMappingList.cpp Thu Jun 28 18:25:40 2012
@@ -176,7 +176,7 @@
 bool
 PathMappingList::RemapPath (const char *path, std::string &new_path) const
 {
-    if (!m_pairs.empty() || path == NULL || path[0] == '\0')
+    if (m_pairs.empty() || path == NULL || path[0] == '\0')
         return false;
 
     const_iterator pos, end = m_pairs.end();

Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=159391&r1=159390&r2=159391&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Thu Jun 28 18:25:40 2012
@@ -62,8 +62,6 @@
 // I'm seeing this, instead.
 #define WATCHPOINT_OCCURRED     ((uint32_t)(10u))
 
-//#define DNB_ARCH_MACH_ARM_DEBUG_SW_STEP 1
-
 static const uint8_t g_arm_breakpoint_opcode[] = { 0xFE, 0xDE, 0xFF, 0xE7 };
 static const uint8_t g_thumb_breakpooint_opcode[] = { 0xFE, 0xDE };
 
@@ -340,23 +338,20 @@
     // Do we need to step this thread? If so, let the mach thread tell us so.
     if (m_thread->IsStepping())
     {
-        bool step_handled = false;
         // This is the primary thread, let the arch do anything it needs
         if (NumSupportedHardwareBreakpoints() > 0)
         {
-#if defined (DNB_ARCH_MACH_ARM_DEBUG_SW_STEP)
-            bool half_step = m_hw_single_chained_step_addr != INVALID_NUB_ADDRESS;
-#endif
-            step_handled = EnableHardwareSingleStep(true) == KERN_SUCCESS;
-#if defined (DNB_ARCH_MACH_ARM_DEBUG_SW_STEP)
-            if (!half_step)
-                step_handled = false;
-#endif
+            if (EnableHardwareSingleStep(true) != KERN_SUCCESS)
+            {
+                DNBLogThreaded("DNBArchMachARM::ThreadWillResume() failed to enable hardware single step");
+            }
         }
-
-        if (!step_handled)
+        else
         {
-            SetSingleStepSoftwareBreakpoints();
+            if (SetSingleStepSoftwareBreakpoints() != KERN_SUCCESS)
+            {
+                DNBLogThreaded("DNBArchMachARM::ThreadWillResume() failed to enable software single step");
+            }
         }
     }
 
@@ -434,32 +429,6 @@
         // We are single stepping, was this the primary thread?
         if (m_thread->IsStepping())
         {
-#if defined (DNB_ARCH_MACH_ARM_DEBUG_SW_STEP)
-            success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
-            // Hardware single step must work if we are going to test software
-            // single step functionality
-            assert(success);
-            if (m_hw_single_chained_step_addr == INVALID_NUB_ADDRESS && m_sw_single_step_next_pc != INVALID_NUB_ADDRESS)
-            {
-                uint32_t sw_step_next_pc = m_sw_single_step_next_pc & 0xFFFFFFFEu;
-                bool sw_step_next_pc_is_thumb = (m_sw_single_step_next_pc & 1) != 0;
-                bool actual_next_pc_is_thumb = (m_state.context.gpr.__cpsr & 0x20) != 0;
-                if (m_state.context.gpr.__pc != sw_step_next_pc)
-                {
-                    DNBLogError("curr pc = 0x%8.8x - calculated single step target PC was incorrect: 0x%8.8x != 0x%8.8x", m_state.context.gpr.__pc, sw_step_next_pc, m_state.context.gpr.__pc);
-                    exit(1);
-                }
-                if (actual_next_pc_is_thumb != sw_step_next_pc_is_thumb)
-                {
-                    DNBLogError("curr pc = 0x%8.8x - calculated single step calculated mode mismatch: sw single mode = %s != %s",
-                                m_state.context.gpr.__pc,
-                                actual_next_pc_is_thumb ? "Thumb" : "ARM",
-                                sw_step_next_pc_is_thumb ? "Thumb" : "ARM");
-                    exit(1);
-                }
-                m_sw_single_step_next_pc = INVALID_NUB_ADDRESS;
-            }
-#else
             // Are we software single stepping?
             if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_break_id) || m_sw_single_step_itblock_break_count)
             {
@@ -512,7 +481,6 @@
             }
             else
                 success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
-#endif
         }
         else
         {
@@ -2153,11 +2121,6 @@
     {
         err = KERN_SUCCESS;
 
-#if defined DNB_ARCH_MACH_ARM_DEBUG_SW_STEP
-        m_sw_single_step_next_pc = next_pc;
-        if (next_pc_is_thumb)
-            m_sw_single_step_next_pc |= 1;  // Set bit zero if the next PC is expected to be Thumb
-#else
         const DNBBreakpoint *bp = m_thread->Process()->Breakpoints().FindByAddress(next_pc);
 
         if (bp == NULL)
@@ -2167,7 +2130,6 @@
                 err = KERN_INVALID_ARGUMENT;
             DNBLogThreadedIf(LOG_STEP, "%s: software single step breakpoint with breakID=%d set at 0x%8.8x", __FUNCTION__, m_sw_single_step_break_id, next_pc);
         }
-#endif
     }
 #else
     err.LogThreaded("%s: ARMDisassembler.framework support is disabled", __FUNCTION__);





More information about the lldb-commits mailing list