[Lldb-commits] [lldb] r164050 - in /lldb/trunk: include/lldb/Target/ObjCLanguageRuntime.h source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Enrico Granata egranata at apple.com
Mon Sep 17 12:51:33 PDT 2012


Author: enrico
Date: Mon Sep 17 14:51:33 2012
New Revision: 164050

URL: http://llvm.org/viewvc/llvm-project?rev=164050&view=rev
Log:
Make the Class Descriptors able to fetch the class name for unrealized classes

Modified:
    lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=164050&r1=164049&r2=164050&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Mon Sep 17 14:51:33 2012
@@ -95,6 +95,13 @@
         virtual uint64_t
         GetInstanceSize () = 0;
         
+        virtual bool
+        IsRealized ()
+        {
+            // anything other than some instances of v2 classes are always realized
+            return true;
+        }
+        
         // use to implement version-specific additional constraints on pointers
         virtual bool
         CheckPointer (lldb::addr_t value,

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=164050&r1=164049&r2=164050&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Mon Sep 17 14:51:33 2012
@@ -1029,6 +1029,12 @@
         return m_isa;
     }
     
+    virtual bool
+    IsRealized ()
+    {
+        return m_realized;
+    }
+    
     virtual
     ~ClassDescriptorV2 ()
     {}
@@ -1107,9 +1113,28 @@
             return;
         }
         
+        lldb::addr_t rot_pointer;
+        
         // now construct the data object
         
-        lldb::addr_t rot_pointer = process_sp->ReadPointerFromMemory(data_ptr + 8, error);
+        uint32_t flags;
+        process_sp->ReadMemory(data_ptr, &flags, 4, error);
+        if (error.Fail())
+        {
+            m_valid = false;
+            return;
+        }
+
+        if (flags & RW_REALIZED)
+        {
+            m_realized = true;
+            rot_pointer = process_sp->ReadPointerFromMemory(data_ptr + 8, error);
+        }
+        else
+        {
+            m_realized = false;
+            rot_pointer = data_ptr;
+        }
         
         if (error.Fail())
         {
@@ -1154,12 +1179,14 @@
     }
     
 private:
+    static const uint32_t RW_REALIZED = (1 << 31);
     ConstString m_name;
     ObjCLanguageRuntime::ObjCISA m_isa;
     ObjCLanguageRuntime::ObjCISA m_parent_isa;
     bool m_valid;
     lldb::ProcessWP m_process_wp;
     uint64_t m_instance_size;
+    bool m_realized;
 };
 
 class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor





More information about the lldb-commits mailing list