diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index b4f620a1bc..93ff1dc999 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -2549,16 +2549,6 @@ DIETypeUnit::Tag() const } -status_t -DIETypeUnit::AddChild(DebugInfoEntry* child) -{ - if (child->IsType()) - fType = dynamic_cast(child); - - return B_OK; -} - - status_t DIETypeUnit::AddAttribute_language(uint16 attributeName, const AttributeValue& value) diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.h b/src/apps/debugger/dwarf/DebugInfoEntries.h index 6fffdf4176..66b481883c 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.h +++ b/src/apps/debugger/dwarf/DebugInfoEntries.h @@ -1614,16 +1614,11 @@ public: uint16 Language() const { return fLanguage; } - virtual status_t AddChild(DebugInfoEntry* child); - virtual status_t AddAttribute_language(uint16 attributeName, const AttributeValue& value); - inline DIEType* GetType() const { return fType; } - private: uint16 fLanguage; - DIEType* fType; }; diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index fd2c8531fa..66b9c41f5e 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -1142,6 +1142,13 @@ DwarfFile::_ParseTypeUnit(TypeUnit* unit) } unit->SetUnitEntry(unitEntry); + DebugInfoEntry* typeEntry = unit->EntryForOffset(unit->TypeOffset()); + if (typeEntry == NULL) { + WARNING("No type found for type unit %p at specified offset %" + B_PRId64 ".\n", unit, unit->TypeOffset()); + return B_BAD_DATA; + } + unit->SetTypeEntry(typeEntry); TRACE_DIE_ONLY( TRACE_DIE("remaining bytes in unit: %" B_PRIdOFF "\n", @@ -2591,6 +2598,7 @@ DwarfFile::_ResolveReference(BaseUnit* unit, uint64 offset, } case dwarf_reference_type_signature: { + TRACE_DIE("Resolving signature %#" B_PRIx64 "\n", offset); TypeUnitTableEntry* entry = fTypeUnits.Lookup(offset); if (entry != NULL && entry->unit != NULL) return entry->unit->TypeEntry(); diff --git a/src/apps/debugger/dwarf/TypeUnit.cpp b/src/apps/debugger/dwarf/TypeUnit.cpp index 0a3af5d85a..6dd4113bd6 100644 --- a/src/apps/debugger/dwarf/TypeUnit.cpp +++ b/src/apps/debugger/dwarf/TypeUnit.cpp @@ -16,6 +16,7 @@ TypeUnit::TypeUnit(off_t headerOffset, off_t contentOffset, BaseUnit(headerOffset, contentOffset, totalSize, abbreviationOffset, addressSize, isDwarf64), fUnitEntry(NULL), + fTypeEntry(NULL), fSignature(signature), fTypeOffset(typeOffset) { @@ -37,10 +38,14 @@ TypeUnit::SetUnitEntry(DIETypeUnit* entry) DebugInfoEntry* TypeUnit::TypeEntry() const { - if (fUnitEntry != NULL) - return fUnitEntry->GetType(); + return fTypeEntry; +} - return NULL; + +void +TypeUnit::SetTypeEntry(DebugInfoEntry* entry) +{ + fTypeEntry = entry; } diff --git a/src/apps/debugger/dwarf/TypeUnit.h b/src/apps/debugger/dwarf/TypeUnit.h index 74664e6491..ee3d594f2b 100644 --- a/src/apps/debugger/dwarf/TypeUnit.h +++ b/src/apps/debugger/dwarf/TypeUnit.h @@ -36,11 +36,13 @@ public: void SetUnitEntry(DIETypeUnit* entry); DebugInfoEntry* TypeEntry() const; + void SetTypeEntry(DebugInfoEntry* entry); virtual dwarf_unit_kind Kind() const; private: DIETypeUnit* fUnitEntry; + DebugInfoEntry* fTypeEntry; uint64 fSignature; off_t fTypeOffset; };