From 18c9c018a1d6595374bff7e48c26a62cb8fbedcb Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 16 Jul 2013 22:39:13 -0400 Subject: [PATCH] Add DIETypeUnit. Represents a top level unit from DWARF 4's .debug_types section, akin to a compilation unit. --- src/apps/debugger/dwarf/DebugInfoEntries.cpp | 39 ++++++++++++++++++++ src/apps/debugger/dwarf/DebugInfoEntries.h | 21 +++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index 9d3ff63f31..c8c8852950 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -2527,6 +2527,42 @@ DIESharedType::AddAttribute_decl_column(uint16 attributeName, } +// #pragma mark - DIETypeUnit + + +DIETypeUnit::DIETypeUnit() + : + fLanguage(0) +{ +} + + +uint16 +DIETypeUnit::Tag() const +{ + return DW_TAG_type_unit; +} + + +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) +{ + fLanguage = value.constant; + return B_OK; +} + + // #pragma mark - DIETemplateTypeParameterPack @@ -2887,6 +2923,9 @@ DebugInfoEntryFactory::CreateDebugInfoEntry(uint16 tag, DebugInfoEntry*& _entry) case DW_TAG_shared_type: entry = new(std::nothrow) DIESharedType; break; + case DW_TAG_type_unit: + entry = new(std::nothrow) DIETypeUnit; + break; case DW_TAG_GNU_template_parameter_pack: entry = new(std::nothrow) DIETemplateTypeParameterPack; break; diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.h b/src/apps/debugger/dwarf/DebugInfoEntries.h index 0c74f68b3c..6fffdf4176 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.h +++ b/src/apps/debugger/dwarf/DebugInfoEntries.h @@ -1606,6 +1606,27 @@ private: }; +class DIETypeUnit : public DebugInfoEntry { +public: + DIETypeUnit(); + + virtual uint16 Tag() const; + + 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; +}; + + class DIETemplateTypeParameterPack : public DIEDeclaredBase { public: DIETemplateTypeParameterPack();