[Lldb-commits] [lldb] r213218 - Two fixes in the Objective-C language runtime:

Sean Callanan scallanan at apple.com
Wed Jul 16 18:20:37 PDT 2014


Author: spyffe
Date: Wed Jul 16 20:20:37 2014
New Revision: 213218

URL: http://llvm.org/viewvc/llvm-project?rev=213218&view=rev
Log:
Two fixes in the Objective-C language runtime:

- First, when logging, be helpful by printing
  the real name of the class;

- Second, up the limit for number of classes
  from 16k to 128k, and put in an assertion
  (and better error handling when not in a
  debug configuration) when we cross that
  limit the next time.

<rdar://problem/17052976>

Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=213218&r1=213217&r2=213218&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Wed Jul 16 20:20:37 2014
@@ -1929,7 +1929,7 @@ AppleObjCRuntimeV2::ParseClassInfoArray
             ClassDescriptorSP descriptor_sp (new ClassDescriptorV2(*this, isa, NULL));
             AddClass (isa, descriptor_sp, name_hash);
             if (log && log->GetVerbose())
-                log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64 ", hash=0x%8.8x", isa, name_hash);
+                log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64 ", hash=0x%8.8x, name=%s", isa, name_hash,descriptor_sp->GetClassName().AsCString("<unknown>"));
         }
     }
 }
@@ -1971,7 +1971,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
         return false;
     
     // Read the total number of classes from the hash table
-    const uint32_t num_classes = 16*1024;
+    const uint32_t num_classes = 128*1024;
     if (num_classes == 0)
     {
         if (log)
@@ -2108,8 +2108,22 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
             uint32_t num_class_infos = return_value.GetScalar().ULong();
             if (log)
                 log->Printf("Discovered %u ObjC classes in shared cache\n",num_class_infos);
+#ifdef LLDB_CONFIGURATION_DEBUG
+            assert (num_class_infos <= num_classes);
+#endif
             if (num_class_infos > 0)
             {
+                if (num_class_infos > num_classes)
+                {
+                    num_class_infos = num_classes;
+                    
+                    success = false;
+                }
+                else
+                {
+                    success = true;
+                }
+                
                 // Read the ClassInfo structures
                 DataBufferHeap buffer (num_class_infos * class_info_byte_size, 0);
                 if (process->ReadMemory(class_infos_addr,
@@ -2125,7 +2139,10 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
                     ParseClassInfoArray (class_infos_data, num_class_infos);
                 }
             }
-            success = true;
+            else
+            {
+                success = true;
+            }
         }
         else
         {





More information about the lldb-commits mailing list