[Lldb-commits] [lldb] r155043 - in /lldb/branches/lldb-platform-work: ./ include/lldb/Symbol/ lldb.xcodeproj/ resources/ source/Host/macosx/launcherXPCService/ source/Plugins/Instruction/ARM/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/Platform/MacOSX/ source/Plugins/SymbolFile/DWARF/ source/Plugins/SymbolFile/Symtab/ source/Symbol/

Johnny Chen johnny.chen at apple.com
Wed Apr 18 13:42:08 PDT 2012


Author: johnny
Date: Wed Apr 18 15:42:07 2012
New Revision: 155043

URL: http://llvm.org/viewvc/llvm-project?rev=155043&view=rev
Log:
Merge changes from ToT:

svn merge -r 154966:154984 https://johnny@llvm.org/svn/llvm-project/lldb/trunk .

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h
    lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
    lldb/branches/lldb-platform-work/resources/LLDB-Info.plist
    lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
    lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
    lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
    lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
    lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
    lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Apr 18 15:42:07 2012
@@ -1 +1 @@
-/lldb/trunk:154224-154966
+/lldb/trunk:154224-154984

Modified: lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Symbol/ClangASTContext.h Wed Apr 18 15:42:07 2012
@@ -291,7 +291,7 @@
                       const char *name,
                       int kind,
                       lldb::LanguageType language,
-                      clang::CXXRecordDecl **decl = NULL);
+                      uint64_t metadata = 0);
 
     static clang::FieldDecl *
     AddFieldToRecordType (clang::ASTContext *ast,
@@ -449,7 +449,8 @@
     CreateObjCClass (const char *name, 
                      clang::DeclContext *decl_ctx, 
                      bool isForwardDecl, 
-                     bool isInternal);
+                     bool isInternal,
+                     uint64_t metadata = 0);
     
     static clang::FieldDecl *
     AddObjCClassIVar (clang::ASTContext *ast,
@@ -487,7 +488,8 @@
         clang::ObjCIvarDecl *ivar_decl,   
         const char *property_setter_name,
         const char *property_getter_name,
-        uint32_t property_attributes
+        uint32_t property_attributes,
+        uint64_t metadata = 0
     );
 
     bool
@@ -499,7 +501,8 @@
         clang::ObjCIvarDecl *ivar_decl,   
         const char *property_setter_name,
         const char *property_getter_name,
-        uint32_t property_attributes
+        uint32_t property_attributes,
+        uint64_t metadata = 0
     )
     {
         return ClangASTContext::AddObjCClassProperty (getASTContext(),
@@ -509,7 +512,8 @@
                                                       ivar_decl,
                                                       property_setter_name,
                                                       property_getter_name,
-                                                      property_attributes);
+                                                      property_attributes,
+                                                      metadata);
     }
     
     bool

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=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Wed Apr 18 15:42:07 2012
@@ -4211,9 +4211,9 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
-				CURRENT_PROJECT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 140;
+				DYLIB_CURRENT_VERSION = 141;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4273,10 +4273,10 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
-				CURRENT_PROJECT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 140;
+				DYLIB_CURRENT_VERSION = 141;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4388,8 +4388,8 @@
 		2689FFD513353D7A00698AC0 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 140;
-				DYLIB_CURRENT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
+				DYLIB_CURRENT_VERSION = 141;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4417,8 +4417,8 @@
 		2689FFD613353D7A00698AC0 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 140;
-				DYLIB_CURRENT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
+				DYLIB_CURRENT_VERSION = 141;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4446,8 +4446,8 @@
 		2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 140;
-				DYLIB_CURRENT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
+				DYLIB_CURRENT_VERSION = 141;
 				EXECUTABLE_EXTENSION = a;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4533,7 +4533,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4573,10 +4573,10 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_OBJC_RUNTIME = NO;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
 				DEAD_CODE_STRIPPING = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 140;
+				DYLIB_CURRENT_VERSION = 141;
 				EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -4877,7 +4877,7 @@
 		26F5C26C10F3D9A5009D5894 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4907,7 +4907,7 @@
 		26F5C26D10F3D9A5009D5894 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 140;
+				CURRENT_PROJECT_VERSION = 141;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",

Modified: lldb/branches/lldb-platform-work/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/resources/LLDB-Info.plist?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/resources/LLDB-Info.plist (original)
+++ lldb/branches/lldb-platform-work/resources/LLDB-Info.plist Wed Apr 18 15:42:07 2012
@@ -17,7 +17,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>140</string>
+	<string>141</string>
 	<key>CFBundleName</key>
 	<string>${EXECUTABLE_NAME}</string>
 </dict>

Modified: lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist (original)
+++ lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherRootXPCService-Info.plist Wed Apr 18 15:42:07 2012
@@ -25,7 +25,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>140</string>
+	<string>141</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
 	<key>XPCService</key>

Modified: lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist (original)
+++ lldb/branches/lldb-platform-work/source/Host/macosx/launcherXPCService/LauncherXPCService-Info.plist Wed Apr 18 15:42:07 2012
@@ -25,7 +25,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>140</string>
+	<string>141</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2012 Apple Inc. All rights reserved.</string>
 	<key>XPCService</key>

Modified: lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Wed Apr 18 15:42:07 2012
@@ -130,16 +130,17 @@
 #define ARMv6K    (1u << 6)
 #define ARMv6T2   (1u << 7)
 #define ARMv7     (1u << 8)
-#define ARMv8     (1u << 9)
+#define ARMv7S    (1u << 9)
+#define ARMv8     (1u << 10)
 #define ARMvAll   (0xffffffffu)
 
-#define ARMV4T_ABOVE  (ARMv4T|ARMv5T|ARMv5TE|ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv8)
-#define ARMV5_ABOVE   (ARMv5T|ARMv5TE|ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv8)
-#define ARMV5TE_ABOVE (ARMv5TE|ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv8)
-#define ARMV5J_ABOVE  (ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv8)
-#define ARMV6_ABOVE   (ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv8) 
-#define ARMV6T2_ABOVE (ARMv6T2|ARMv7|ARMv8)
-#define ARMV7_ABOVE   (ARMv7|ARMv8)
+#define ARMV4T_ABOVE  (ARMv4T|ARMv5T|ARMv5TE|ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv7S|ARMv8)
+#define ARMV5_ABOVE   (ARMv5T|ARMv5TE|ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv7S|ARMv8)
+#define ARMV5TE_ABOVE (ARMv5TE|ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv7S|ARMv8)
+#define ARMV5J_ABOVE  (ARMv5TEJ|ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv7S|ARMv8)
+#define ARMV6_ABOVE   (ARMv6|ARMv6K|ARMv6T2|ARMv7|ARMv7S|ARMv8) 
+#define ARMV6T2_ABOVE (ARMv6T2|ARMv7|ARMv7S|ARMv8)
+#define ARMV7_ABOVE   (ARMv7|ARMv7S|ARMv8)
 
 #define No_VFP  0
 #define VFPv1   (1u << 1)
@@ -12787,6 +12788,7 @@
         else if (0 == ::strcasecmp(arch_cstr, "armv6"))     m_arm_isa = ARMv6;
         else if (0 == ::strcasecmp(arch_cstr, "armv6t2"))   m_arm_isa = ARMv6T2;
         else if (0 == ::strcasecmp(arch_cstr, "armv7"))     m_arm_isa = ARMv7;
+        else if (0 == ::strcasecmp(arch_cstr, "armv7s"))    m_arm_isa = ARMv7S;
         else if (0 == ::strcasecmp(arch_cstr, "armv8"))     m_arm_isa = ARMv8;
         else if (0 == ::strcasecmp(arch_cstr, "arm"))       m_arm_isa = ARMvAll;
         else if (0 == ::strcasecmp(arch_cstr, "thumb"))     m_arm_isa = ARMvAll;

Modified: lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Apr 18 15:42:07 2012
@@ -26,7 +26,9 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Symbol/ClangNamespaceDecl.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_arm.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_i386.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_x86_64.h"
@@ -1252,18 +1254,56 @@
                 const addr_t linkedit_file_offset = linkedit_section_sp->GetFileOffset();
                 const addr_t symoff_addr = linkedit_load_addr + symtab_load_command.symoff - linkedit_file_offset;
                 const addr_t stroff_addr = linkedit_load_addr + symtab_load_command.stroff - linkedit_file_offset;
-                DataBufferSP nlist_data_sp (ReadMemory (process_sp, symoff_addr, nlist_data_byte_size));
-                if (nlist_data_sp)
-                    nlist_data.SetData (nlist_data_sp, 0, nlist_data_sp->GetByteSize());
-                DataBufferSP strtab_data_sp (ReadMemory (process_sp, stroff_addr, strtab_data_byte_size));
-                if (strtab_data_sp)
-                    strtab_data.SetData (strtab_data_sp, 0, strtab_data_sp->GetByteSize());
-                if (function_starts_load_command.cmd)
-                {
-                    const addr_t func_start_addr = linkedit_load_addr + function_starts_load_command.dataoff - linkedit_file_offset;
-                    DataBufferSP func_start_data_sp (ReadMemory (process_sp, func_start_addr, function_starts_load_command.datasize));
-                    if (func_start_data_sp)
-                        function_starts_data.SetData (func_start_data_sp, 0, func_start_data_sp->GetByteSize());
+
+                bool data_was_read = false;
+
+#if defined (__APPLE__) && defined (__arm__)
+                if (m_header.flags & 0x80000000u)
+                {
+                    // This mach-o memory file is in the dyld shared cache. If this
+                    // program is not remote and this is iOS, then this process will
+                    // share the same shared cache as the process we are debugging and
+                    // we can read the entire __LINKEDIT from the address space in this
+                    // process. This is a needed optimization that is used for local iOS
+                    // debugging only since all shared libraries in the shared cache do
+                    // not have corresponding files that exist in the file system of the
+                    // device. They have been combined into a single file. This means we
+                    // always have to load these files from memory. All of the symbol and
+                    // string tables from all of the __LINKEDIT sections from the shared
+                    // libraries in the shared cache have been merged into a single large
+                    // symbol and string table. Reading all of this symbol and string table
+                    // data across can slow down debug launch times, so we optimize this by
+                    // reading the memory for the __LINKEDIT section from this process.
+                    PlatformSP platform_sp (target.GetPlatform());
+                    if (platform_sp && platform_sp->IsHost())
+                    {
+                        data_was_read = true;
+                        nlist_data.SetData((void *)symoff_addr, nlist_data_byte_size, eByteOrderLittle);
+                        strtab_data.SetData((void *)stroff_addr, strtab_data_byte_size, eByteOrderLittle);
+                        if (function_starts_load_command.cmd)
+                        {
+                            const addr_t func_start_addr = linkedit_load_addr + function_starts_load_command.dataoff - linkedit_file_offset;
+                            function_starts_data.SetData ((void *)func_start_addr, function_starts_load_command.datasize, eByteOrderLittle);
+                        }
+                    }
+                }
+#endif
+
+                if (!data_was_read)
+                {
+                    DataBufferSP nlist_data_sp (ReadMemory (process_sp, symoff_addr, nlist_data_byte_size));
+                    if (nlist_data_sp)
+                        nlist_data.SetData (nlist_data_sp, 0, nlist_data_sp->GetByteSize());
+                    DataBufferSP strtab_data_sp (ReadMemory (process_sp, stroff_addr, strtab_data_byte_size));
+                    if (strtab_data_sp)
+                        strtab_data.SetData (strtab_data_sp, 0, strtab_data_sp->GetByteSize());
+                    if (function_starts_load_command.cmd)
+                    {
+                        const addr_t func_start_addr = linkedit_load_addr + function_starts_load_command.dataoff - linkedit_file_offset;
+                        DataBufferSP func_start_data_sp (ReadMemory (process_sp, func_start_addr, function_starts_load_command.datasize));
+                        if (func_start_data_sp)
+                            function_starts_data.SetData (func_start_data_sp, 0, func_start_data_sp->GetByteSize());
+                    }
                 }
             }
         }

Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Wed Apr 18 15:42:07 2012
@@ -28,11 +28,15 @@
 using namespace lldb;
 using namespace lldb_private;
 
-PlatformRemoteiOS::SDKDirectoryInfo::SDKDirectoryInfo (const lldb_private::ConstString &dirname) :
-    directory(dirname),
-    build()
+PlatformRemoteiOS::SDKDirectoryInfo::SDKDirectoryInfo (const lldb_private::FileSpec &sdk_dir) :
+    directory(sdk_dir),
+    build(),
+    version_major(0),
+    version_minor(0),
+    version_update(0),
+    user_cached(false)
 {
-    const char *dirname_cstr = dirname.GetCString();
+    const char *dirname_cstr = sdk_dir.GetFilename().GetCString();
     const char *pos = Args::StringToVersion (dirname_cstr,
                                              version_major,
                                              version_minor,
@@ -155,6 +159,16 @@
         strm.Printf ("  SDK Path: \"%s\"\n", sdk_directory);
     else
         strm.PutCString ("  SDK Path: error: unable to locate SDK\n");
+    
+//    const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+//    for (uint32_t i=0; i<num_sdk_infos; ++i)
+//    {
+//        const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
+//        strm.Printf (" SDK Roots: [%2u] \"%s/%s\"\n",
+//                     i,
+//                     sdk_dir_info.directory.GetDirectory().GetCString(),
+//                     sdk_dir_info.directory.GetFilename().GetCString());
+//    }
 }
 
 
@@ -247,7 +261,7 @@
                                                                  FileSpec::FileType file_type,
                                                                  const FileSpec &file_spec)
 {
-    ((PlatformRemoteiOS::SDKDirectoryInfoCollection *)baton)->push_back(PlatformRemoteiOS::SDKDirectoryInfo(file_spec.GetFilename()));
+    ((PlatformRemoteiOS::SDKDirectoryInfoCollection *)baton)->push_back(PlatformRemoteiOS::SDKDirectoryInfo(file_spec));
     return FileSpec::eEnumerateDirectoryResultNext;
 }
 
@@ -268,6 +282,28 @@
                                           find_other,
                                           GetContainedFilesIntoVectorOfStringsCallback,
                                           &m_sdk_directory_infos);
+            
+            const uint32_t num_installed = m_sdk_directory_infos.size();
+            FileSpec local_sdk_cache("~/Library/Developer/Xcode/iOS DeviceSupport", true);
+            if (local_sdk_cache.Exists())
+            {
+                char path[PATH_MAX];
+                if (local_sdk_cache.GetPath(path, sizeof(path)))
+                {
+                    FileSpec::EnumerateDirectory (path,
+                                                  find_directories,
+                                                  find_files,
+                                                  find_other,
+                                                  GetContainedFilesIntoVectorOfStringsCallback,
+                                                  &m_sdk_directory_infos);
+                    const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+                    // First try for an exact match of major, minor and update
+                    for (uint32_t i=num_installed; i<num_sdk_infos; ++i)
+                    {
+                        m_sdk_directory_infos[i].user_cached = true;
+                    }
+                }
+            }
         }
     }
     return !m_sdk_directory_infos.empty();
@@ -276,44 +312,73 @@
 const PlatformRemoteiOS::SDKDirectoryInfo *
 PlatformRemoteiOS::GetSDKDirectoryForCurrentOSVersion ()
 {
-    uint32_t major, minor, update;
-    if (GetOSVersion(major, minor, update))
+    uint32_t i;
+    if (UpdateSDKDirectoryInfosInNeeded())
     {
-        if (UpdateSDKDirectoryInfosInNeeded())
+        const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+
+        // Check to see if the user specified a build string. If they did, then
+        // be sure to match it.
+        std::vector<bool> check_sdk_info(num_sdk_infos, true);
+        ConstString build(m_sdk_build);
+        if (build)
         {
-            uint32_t i;
-            const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
-            // First try for an exact match of major, minor and update
             for (i=0; i<num_sdk_infos; ++i)
+                check_sdk_info[i] = m_sdk_directory_infos[i].build == build;
+        }
+        
+        // If we are connected we can find the version of the OS the platform
+        // us running on and select the right SDK
+        uint32_t major, minor, update;
+        if (GetOSVersion(major, minor, update))
+        {
+            if (UpdateSDKDirectoryInfosInNeeded())
             {
-                const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
-                if (sdk_dir_info.version_major == major &&
-                    sdk_dir_info.version_minor == minor &&
-                    sdk_dir_info.version_update == update)
+                // First try for an exact match of major, minor and update
+                for (i=0; i<num_sdk_infos; ++i)
                 {
-                    return &sdk_dir_info;
+                    if (check_sdk_info[i])
+                    {
+                        if (m_sdk_directory_infos[i].version_major == major &&
+                            m_sdk_directory_infos[i].version_minor == minor &&
+                            m_sdk_directory_infos[i].version_update == update)
+                        {
+                            return &m_sdk_directory_infos[i];
+                        }
+                    }
                 }
-            }
-            // First try for an exact match of major and minor
-            for (i=0; i<num_sdk_infos; ++i)
-            {
-                const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
-                if (sdk_dir_info.version_major == major &&
-                    sdk_dir_info.version_minor == minor)
+                // First try for an exact match of major and minor
+                for (i=0; i<num_sdk_infos; ++i)
                 {
-                    return &sdk_dir_info;
+                    if (check_sdk_info[i])
+                    {
+                        if (m_sdk_directory_infos[i].version_major == major &&
+                            m_sdk_directory_infos[i].version_minor == minor)
+                        {
+                            return &m_sdk_directory_infos[i];
+                        }
+                    }
                 }
-            }
-            // Lastly try to match of major version only..
-            for (i=0; i<num_sdk_infos; ++i)
-            {
-                const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
-                if (sdk_dir_info.version_major == major)
+                // Lastly try to match of major version only..
+                for (i=0; i<num_sdk_infos; ++i)
                 {
-                    return &sdk_dir_info;
+                    if (check_sdk_info[i])
+                    {
+                        if (m_sdk_directory_infos[i].version_major == major)
+                        {
+                            return &m_sdk_directory_infos[i];
+                        }
+                    }
                 }
             }
         }
+        else if (build)
+        {
+            // No version, just a build number, search for the first one that matches
+            for (i=0; i<num_sdk_infos; ++i)
+                if (check_sdk_info[i])
+                    return &m_sdk_directory_infos[i];
+        }
     }
     return NULL;
 }
@@ -397,9 +462,12 @@
             sdk_dir_info = GetSDKDirectoryForLatestOSVersion ();
         if (sdk_dir_info)
         {
-            m_device_support_directory_for_os_version = GetDeviceSupportDirectory();
-            m_device_support_directory_for_os_version.append(1, '/');
-            m_device_support_directory_for_os_version.append(sdk_dir_info->directory.GetCString());
+            char path[PATH_MAX];
+            if (sdk_dir_info->directory.GetPath(path, sizeof(path)))
+            {
+                m_device_support_directory_for_os_version = path;
+                return m_device_support_directory_for_os_version.c_str();
+            }
         }
         else
         {

Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h Wed Apr 18 15:42:07 2012
@@ -117,12 +117,13 @@
 protected:
     struct SDKDirectoryInfo
     {
-        SDKDirectoryInfo (const lldb_private::ConstString &dirname);
-        lldb_private::ConstString directory;
+        SDKDirectoryInfo (const lldb_private::FileSpec &sdk_dir_spec);
+        lldb_private::FileSpec directory;
         lldb_private::ConstString build;
         uint32_t version_major;
         uint32_t version_minor;
         uint32_t version_update;
+        bool user_cached;
     };
     typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;
     std::string m_device_support_directory;

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Apr 18 15:42:07 2012
@@ -1737,9 +1737,11 @@
                                                                        ivar_decl,
                                                                        prop_setter_name,
                                                                        prop_getter_name,
-                                                                       prop_attributes);
+                                                                       prop_attributes,
+                                                                       MakeUserID(die->GetOffset()));
                             
-                            GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
+                            if (ivar_decl)
+                                GetClangASTContext().SetMetadata((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
                         }
                     }
                 }
@@ -5176,14 +5178,12 @@
                         if (!clang_type_was_created)
                         {
                             clang_type_was_created = true;
-                            clang::CXXRecordDecl *record_decl;
                             clang_type = ast.CreateRecordType (decl_ctx, 
                                                                accessibility, 
                                                                type_name_cstr, 
                                                                tag_decl_kind, 
                                                                class_language,
-                                                               &record_decl);
-                            GetClangASTContext().SetMetadata((uintptr_t)record_decl, MakeUserID(die->GetOffset()));
+                                                               MakeUserID(die->GetOffset()));
                         }
                     }
 

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Wed Apr 18 15:42:07 2012
@@ -407,7 +407,8 @@
         lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(), 
                                                                    ast.GetTranslationUnitDecl(), 
                                                                    isForwardDecl, 
-                                                                   isInternal);
+                                                                   isInternal,
+                                                                   0xffaaffaaffaaffaall);
         
         Declaration decl;
         

Modified: lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp?rev=155043&r1=155042&r2=155043&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/ClangASTContext.cpp Wed Apr 18 15:42:07 2012
@@ -1125,14 +1125,11 @@
 #pragma mark Structure, Unions, Classes
 
 clang_type_t
-ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, CXXRecordDecl **out_decl)
+ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, uint64_t metadata)
 {
     ASTContext *ast = getASTContext();
     assert (ast != NULL);
- 
-    if (out_decl)
-        *out_decl = NULL;
-    
+     
     if (decl_ctx == NULL)
         decl_ctx = ast->getTranslationUnitDecl();
 
@@ -1141,7 +1138,7 @@
     {
         bool isForwardDecl = true;
         bool isInternal = false;
-        return CreateObjCClass (name, decl_ctx, isForwardDecl, isInternal);
+        return CreateObjCClass (name, decl_ctx, isForwardDecl, isInternal, metadata);
     }
 
     // NOTE: Eventually CXXRecordDecl will be merged back into RecordDecl and
@@ -1156,8 +1153,8 @@
                                                  SourceLocation(),
                                                  name && name[0] ? &ast->Idents.get(name) : NULL);
     
-    if (out_decl)
-        *out_decl = decl;
+    if (decl)
+        SetMetadata(ast, (uintptr_t)decl, metadata);
     
     if (!name)
         decl->setAnonymousStructOrUnion(true);
@@ -2251,12 +2248,13 @@
 #pragma mark Objective C Classes
 
 clang_type_t
-ClangASTContext::CreateObjCClass 
+ClangASTContext::CreateObjCClass
 (
     const char *name, 
     DeclContext *decl_ctx, 
     bool isForwardDecl, 
-    bool isInternal
+    bool isInternal,
+    uint64_t metadata
 )
 {
     ASTContext *ast = getASTContext();
@@ -2279,6 +2277,9 @@
                                                          /*isForwardDecl,*/
                                                          isInternal);
     
+    if (decl)
+        SetMetadata(ast, (uintptr_t)decl, metadata);
+    
     return ast->getObjCInterfaceType(decl).getAsOpaquePtr();
 }
 
@@ -2390,7 +2391,8 @@
     ObjCIvarDecl *ivar_decl,
     const char *property_setter_name,
     const char *property_getter_name,
-    uint32_t property_attributes
+    uint32_t property_attributes,
+    uint64_t metadata
 )
 {
     if (class_opaque_type == NULL || property_name == NULL || property_name[0] == '\0')
@@ -2434,8 +2436,11 @@
                                                                            SourceLocation(), //Source location for (
                                                                            prop_type_source
                                                                            );
+                
                 if (property_decl)
                 {
+                    SetMetadata(ast, (uintptr_t)property_decl, metadata);
+                    
                     class_interface_decl->addDecl (property_decl);
                     
                     Selector setter_sel, getter_sel;
@@ -2512,6 +2517,9 @@
                                                                         isDefined,
                                                                         impControl,
                                                                         HasRelatedResultType);
+                        
+                        if (getter)
+                            SetMetadata(ast, (uintptr_t)getter, metadata);
                                                 
                         getter->setMethodParams(*ast, ArrayRef<ParmVarDecl*>(), ArrayRef<SourceLocation>());
                         
@@ -2545,6 +2553,9 @@
                                                                         impControl,
                                                                         HasRelatedResultType);
                         
+                        if (setter)
+                            SetMetadata(ast, (uintptr_t)setter, metadata);
+                        
                         llvm::SmallVector<ParmVarDecl *, 1> params;
 
                         params.push_back (ParmVarDecl::Create (*ast,





More information about the lldb-commits mailing list