diff --git a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp index 0da0c4f55f..d6a633dc73 100644 --- a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp +++ b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp @@ -374,7 +374,9 @@ DwarfTypeFactory::_CreateTypeInternal(const BString& name, case DW_TAG_union_type: case DW_TAG_interface_type: return _CreateCompoundType(name, - dynamic_cast(typeEntry), _type); + dynamic_cast(typeEntry), + (compound_type_kind)dwarf_tag_to_subtype_kind( + typeEntry->Tag()), _type); case DW_TAG_base_type: return _CreatePrimitiveType(name, @@ -451,14 +453,14 @@ DwarfTypeFactory::_CreateTypeInternal(const BString& name, status_t DwarfTypeFactory::_CreateCompoundType(const BString& name, - DIECompoundType* typeEntry, DwarfType*& _type) + DIECompoundType* typeEntry, compound_type_kind compoundKind, DwarfType*& _type) { - TRACE_LOCALS("DwarfTypeFactory::_CreateCompoundType(\"%s\", %p)\n", - name.String(), typeEntry); + TRACE_LOCALS("DwarfTypeFactory::_CreateCompoundType(\"%s\", %p, %d)\n", + name.String(), typeEntry, compoundKind); // create the type DwarfCompoundType* type = new(std::nothrow) DwarfCompoundType(fTypeContext, - name, typeEntry); + name, typeEntry, compoundKind); if (type == NULL) return B_NO_MEMORY; BReference typeReference(type, true); diff --git a/src/apps/debugger/debug_info/DwarfTypeFactory.h b/src/apps/debugger/debug_info/DwarfTypeFactory.h index 8c77629df8..ddc7b76a10 100644 --- a/src/apps/debugger/debug_info/DwarfTypeFactory.h +++ b/src/apps/debugger/debug_info/DwarfTypeFactory.h @@ -70,6 +70,7 @@ private: status_t _CreateCompoundType(const BString& name, DIECompoundType* typeEntry, + compound_type_kind compoundKind, DwarfType*& _type); status_t _CreatePrimitiveType(const BString& name, DIEBaseType* typeEntry, diff --git a/src/apps/debugger/debug_info/DwarfTypes.cpp b/src/apps/debugger/debug_info/DwarfTypes.cpp index 328c2a61a0..01450bdf0a 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.cpp +++ b/src/apps/debugger/debug_info/DwarfTypes.cpp @@ -532,9 +532,11 @@ DwarfPrimitiveType::TypeConstant() const DwarfCompoundType::DwarfCompoundType(DwarfTypeContext* typeContext, - const BString& name, DIECompoundType* entry) + const BString& name, DIECompoundType* entry, + compound_type_kind compoundKind) : DwarfType(typeContext, name, entry), + fCompoundKind(compoundKind), fEntry(entry) { } @@ -551,6 +553,13 @@ DwarfCompoundType::~DwarfCompoundType() } +compound_type_kind +DwarfCompoundType::CompoundKind() const +{ + return fCompoundKind; +} + + int32 DwarfCompoundType::CountBaseTypes() const { diff --git a/src/apps/debugger/debug_info/DwarfTypes.h b/src/apps/debugger/debug_info/DwarfTypes.h index 5464c109e5..ef6c4d265e 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.h +++ b/src/apps/debugger/debug_info/DwarfTypes.h @@ -254,9 +254,12 @@ private: class DwarfCompoundType : public CompoundType, public DwarfType { public: DwarfCompoundType(DwarfTypeContext* typeContext, - const BString& name, DIECompoundType* entry); + const BString& name, DIECompoundType* entry, + compound_type_kind compoundKind); ~DwarfCompoundType(); + virtual compound_type_kind CompoundKind() const; + virtual int32 CountBaseTypes() const; virtual BaseType* BaseTypeAt(int32 index) const; @@ -290,6 +293,7 @@ private: ValueLocation*& _location); private: + compound_type_kind fCompoundKind; DIECompoundType* fEntry; InheritanceList fInheritances; DataMemberList fDataMembers; diff --git a/src/apps/debugger/debug_info/GlobalTypeLookup.cpp b/src/apps/debugger/debug_info/GlobalTypeLookup.cpp index 5f2b2aaeb0..e9d83fc883 100644 --- a/src/apps/debugger/debug_info/GlobalTypeLookup.cpp +++ b/src/apps/debugger/debug_info/GlobalTypeLookup.cpp @@ -156,6 +156,23 @@ GlobalTypeCache::GetType(const BString& name, if (constraints.HasTypeKind() && typeEntry->type->Kind() != constraints.TypeKind()) typeEntry = NULL; + else if (constraints.HasSubtypeKind()) { + if (typeEntry->type->Kind() == TYPE_ADDRESS) { + AddressType* type = dynamic_cast( + typeEntry->type); + if (type == NULL) + typeEntry = NULL; + else if (type->AddressKind() != constraints.SubtypeKind()) + typeEntry = NULL; + } else if (typeEntry->type->Kind() == TYPE_COMPOUND) { + CompoundType* type = dynamic_cast( + typeEntry->type); + if (type == NULL) + typeEntry = NULL; + else if (type->CompoundKind() != constraints.SubtypeKind()) + typeEntry = NULL; + } + } } return typeEntry != NULL ? typeEntry->type : NULL; } diff --git a/src/apps/debugger/model/Type.h b/src/apps/debugger/model/Type.h index 50eec701f5..20ffdb901b 100644 --- a/src/apps/debugger/model/Type.h +++ b/src/apps/debugger/model/Type.h @@ -143,6 +143,7 @@ public: virtual ~CompoundType(); virtual type_kind Kind() const; + virtual compound_type_kind CompoundKind() const = 0; virtual int32 CountBaseTypes() const = 0; virtual BaseType* BaseTypeAt(int32 index) const = 0;