From b678b907495dc44ddd342aaa19ad77dc114da51b Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 31 Oct 2014 18:05:26 +0000 Subject: [PATCH] - 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." llvm-svn: 220980 --- .../AppleObjCClassDescriptorV2.cpp | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index 6396dacad9b9..9bf272ca1433 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -390,21 +390,24 @@ ClassDescriptorV2::Describe (std::function 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_func(ivar.m_name.c_str(), ivar.m_type.c_str(), ivar.m_offset_ptr, ivar.m_size)) - break; + 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 (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 (AppleObjCRuntimeV2& runtime, ClassDescrip 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;