[Lldb-commits] [lldb] r164353 - /lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Sean Callanan scallanan at apple.com
Thu Sep 20 19:09:51 PDT 2012


Author: spyffe
Date: Thu Sep 20 21:09:51 2012
New Revision: 164353

URL: http://llvm.org/viewvc/llvm-project?rev=164353&view=rev
Log:
Fixed an oddity in the Objective-C class descriptors
where the descriptor took a pointer to an object and
expected the Initialize function to dereference that
pointer and extract the isa value.  This caused one
of our tests to fail.

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=164353&r1=164352&r2=164353&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Sep 20 21:09:51 2012
@@ -973,13 +973,19 @@
 class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor
 {
 public:
-    ClassDescriptorV2 (ValueObject &isa_pointer)
+    ClassDescriptorV2 (ValueObject &ptr_to_object)
     {
-        ObjCLanguageRuntime::ObjCISA ptr_value = isa_pointer.GetValueAsUnsigned(0);
+        lldb::addr_t object_la = ptr_to_object.GetValueAsUnsigned(0);
+        lldb::ProcessSP process_sp = ptr_to_object.GetProcessSP();
         
-        lldb::ProcessSP process_sp = isa_pointer.GetProcessSP();
+        Error error;
+        ObjCLanguageRuntime::ObjCISA isa = process_sp->ReadPointerFromMemory(object_la,
+                                                                             error);
         
-        Initialize (ptr_value,process_sp);
+        if (isa == LLDB_INVALID_ADDRESS)
+            m_valid = false;
+        else
+            Initialize (isa, process_sp);
     }
     
     ClassDescriptorV2 (ObjCLanguageRuntime::ObjCISA isa, lldb::ProcessSP process_sp)
@@ -1116,27 +1122,21 @@
     }
     
     void
-    Initialize (ObjCLanguageRuntime::ObjCISA pointer_to_isa, lldb::ProcessSP process_sp)
+    Initialize (ObjCLanguageRuntime::ObjCISA objc_class_la, lldb::ProcessSP process_sp)
     {
         m_valid = true;
 
-        if (!pointer_to_isa || !process_sp)
+        if (!objc_class_la || !process_sp)
         {
             m_valid = false;
             return;
         }
         
+        m_objc_class_la = objc_class_la;
+
         size_t ptr_size = process_sp->GetAddressByteSize();
         Error error;
-        
-        m_objc_class_la = process_sp->ReadPointerFromMemory(pointer_to_isa, error);
-
-        if (error.Fail())
-        {
-            m_valid = false;
-            return;
-        }
-        
+                
         const bool allow_NULLs = false;
         const bool allow_tagged = false;
         const bool check_version_specific = true;





More information about the lldb-commits mailing list