[Lldb-commits] [lldb] r220980 - - Fixed a bug where ::Describe for class descriptors

Sean Callanan scallanan at apple.com
Fri Oct 31 11:05:26 PDT 2014


Author: spyffe
Date: Fri Oct 31 13:05:26 2014
New Revision: 220980

URL: http://llvm.org/viewvc/llvm-project?rev=220980&view=rev
Log:
- Fixed a bug where ::Describe for class descriptors
  would fail if the class had no ivars.

- Updated use of the RealizeType API by the class
  descriptors to use "for_expression" rather than
  the misnamed "allow_unknownanytype."

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

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp?rev=220980&r1=220979&r2=220980&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Fri Oct 31 13:05:26 2014
@@ -390,21 +390,24 @@ ClassDescriptorV2::Describe (std::functi
     
     if (ivar_func)
     {
-        ivar_list_t ivar_list;
-        if (!ivar_list.Read(process, class_ro->m_ivars_ptr))
-            return false;
-        
-        if (ivar_list.m_entsize != ivar_t::GetSize(process))
-            return false;
-        
-        ivar_t ivar;
-        
-        for (uint32_t i = 0, e = ivar_list.m_count; i < e; ++i)
-        {
-            ivar.Read(process, ivar_list.m_first_ptr + (i * ivar_list.m_entsize));
+        if (class_ro->m_ivars_ptr != 0)
+        {            
+            ivar_list_t ivar_list;
+            if (!ivar_list.Read(process, class_ro->m_ivars_ptr))
+                return false;
+            
+            if (ivar_list.m_entsize != ivar_t::GetSize(process))
+                return false;
+            
+            ivar_t ivar;
             
-            if (ivar_func(ivar.m_name.c_str(), ivar.m_type.c_str(), ivar.m_offset_ptr, ivar.m_size))
-                break;
+            for (uint32_t i = 0, e = ivar_list.m_count; i < e; ++i)
+            {
+                ivar.Read(process, ivar_list.m_first_ptr + (i * ivar_list.m_entsize));
+                
+                if (ivar_func(ivar.m_name.c_str(), ivar.m_type.c_str(), ivar.m_offset_ptr, ivar.m_size))
+                    break;
+            }
         }
     }
     
@@ -524,9 +527,9 @@ ClassDescriptorV2::iVarsStorage::fill (A
                         nullptr,
                         nullptr,
                         [this,process,encoding_to_type_sp](const char * name, const char * type, lldb::addr_t offset_ptr, uint64_t size) -> bool {
-                 const bool allow_unknownanytype = false;
+                 const bool for_expression = false;
                  const bool stop_loop = false;
-                 ClangASTType ivar_type = encoding_to_type_sp->RealizeType(type, allow_unknownanytype);
+                 ClangASTType ivar_type = encoding_to_type_sp->RealizeType(type, for_expression);
                  if (ivar_type)
                  {
                      Scalar offset_scalar;





More information about the lldb-commits mailing list