[Lldb-commits] [lldb] r123092 - in /lldb/trunk/source: Core/ValueObject.cpp Core/ValueObjectChild.cpp Symbol/ClangASTContext.cpp

Greg Clayton gclayton at apple.com
Sat Jan 8 14:26:47 PST 2011


Author: gclayton
Date: Sat Jan  8 16:26:47 2011
New Revision: 123092

URL: http://llvm.org/viewvc/llvm-project?rev=123092&view=rev
Log:
Make sure we don't assert if we have a child with zero byte size. Also
we now say that "void *" value objects don't have children. 


Modified:
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Core/ValueObjectChild.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=123092&r1=123091&r2=123092&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Sat Jan  8 16:26:47 2011
@@ -383,7 +383,7 @@
                                                                   child_bitfield_bit_size,
                                                                   child_bitfield_bit_offset,
                                                                   child_is_base_class);
-    if (child_clang_type)
+    if (child_clang_type && child_byte_size)
     {
         if (synthetic_index)
             child_byte_offset += child_byte_size * synthetic_index;
@@ -1245,7 +1245,7 @@
                                                                       child_bitfield_bit_size,
                                                                       child_bitfield_bit_offset,
                                                                       child_is_base_class);
-        if (child_clang_type)
+        if (child_clang_type && child_byte_offset)
         {
             ConstString child_name;
             if (!child_name_str.empty())

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=123092&r1=123091&r2=123092&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Sat Jan  8 16:26:47 2011
@@ -47,7 +47,6 @@
 {
     assert (bitfield_bit_size   < (sizeof(m_bitfield_bit_size  ) * CHAR_BIT));
     assert (bitfield_bit_offset < (sizeof(m_bitfield_bit_offset) * CHAR_BIT));
-    assert(byte_size != 0 && "TEMPORARY DEBUGGING ASSERT");
     m_name = name;
 }
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=123092&r1=123091&r2=123092&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Sat Jan  8 16:26:47 2011
@@ -2053,7 +2053,43 @@
     const clang::Type::TypeClass type_class = qual_type->getTypeClass();
     switch (type_class)
     {
-    case clang::Type::Builtin:                  return 1;
+    case clang::Type::Builtin:                  
+        switch (cast<clang::BuiltinType>(qual_type)->getKind())
+        {
+        case clang::BuiltinType::Void:
+        case clang::BuiltinType::NullPtr:  
+            return 0;
+        case clang::BuiltinType::Bool:
+        case clang::BuiltinType::Char_U:
+        case clang::BuiltinType::UChar:
+        case clang::BuiltinType::Char16:
+        case clang::BuiltinType::Char32:
+        case clang::BuiltinType::UShort:
+        case clang::BuiltinType::UInt:
+        case clang::BuiltinType::ULong:
+        case clang::BuiltinType::ULongLong:
+        case clang::BuiltinType::UInt128:
+        case clang::BuiltinType::Char_S:
+        case clang::BuiltinType::SChar:
+        case clang::BuiltinType::WChar:
+        case clang::BuiltinType::Short:
+        case clang::BuiltinType::Int:
+        case clang::BuiltinType::Long:
+        case clang::BuiltinType::LongLong:
+        case clang::BuiltinType::Int128:
+        case clang::BuiltinType::Float:
+        case clang::BuiltinType::Double:
+        case clang::BuiltinType::LongDouble:
+        case clang::BuiltinType::Dependent:
+        case clang::BuiltinType::Overload:
+        case clang::BuiltinType::UndeducedAuto:
+        case clang::BuiltinType::ObjCId:
+        case clang::BuiltinType::ObjCClass:
+        case clang::BuiltinType::ObjCSel:
+            return 1;
+        }
+        break;
+
     case clang::Type::Complex:                  return 2;
     case clang::Type::Pointer:                  return 1;
     case clang::Type::BlockPointer:             return 0;   // If block pointers don't have debug info, then no children for them
@@ -2403,6 +2439,10 @@
             {
                 PointerType *pointer_type = cast<PointerType>(parent_qual_type.getTypePtr());
                 QualType pointee_type = pointer_type->getPointeeType();
+                
+                // Don't dereference "void *" pointers
+                if (pointee_type->isVoidType())
+                    return NULL;
 
                 if (transparent_pointers && ClangASTContext::IsAggregateType (pointee_type.getAsOpaquePtr()))
                 {





More information about the lldb-commits mailing list