Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -126,11 +126,9 @@ const char *GetPubname(const DWARFUnit *cu) const; - static bool GetName(const DWARFUnit *cu, const dw_offset_t die_offset, - lldb_private::Stream &s); + static bool GetName(const DWARFDIE die, lldb_private::Stream &s); - static bool AppendTypeName(const DWARFUnit *cu, const dw_offset_t die_offset, - lldb_private::Stream &s); + static bool AppendTypeName(const DWARFDIE die, lldb_private::Stream &s); const char *GetQualifiedName(DWARFUnit *cu, std::string &storage) const; Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -693,13 +693,13 @@ DWARFDIE abstract_die = form_value.Reference(); form_value.Dump(s); // *ostrm_ptr << HEX32 << abstract_die.GetOffset() << " ( "; - GetName(abstract_die.GetCU(), abstract_die.GetOffset(), s); + GetName(abstract_die, s); } break; case DW_AT_type: { DWARFDIE type_die = form_value.Reference(); s.PutCString(" ( "); - AppendTypeName(type_die.GetCU(), type_die.GetOffset(), s); + AppendTypeName(type_die, s); s.PutCString(" )"); } break; @@ -1043,26 +1043,18 @@ // GetName // -// Get value of the DW_AT_name attribute for a debug information entry that -// exists at offset "die_offset" and place that value into the supplied stream -// object. If the DIE is a NULL object "NULL" is placed into the stream, and if -// no DW_AT_name attribute exists for the DIE then nothing is printed. -bool DWARFDebugInfoEntry::GetName(const DWARFUnit *cu, - const dw_offset_t die_offset, Stream &s) { - if (cu == NULL) { - s.PutCString("NULL"); - return false; - } - - DWARFDebugInfoEntry die; - lldb::offset_t offset = die_offset; - if (die.Extract(cu, &offset)) { - if (die.IsNULL()) { +// Get value of the DW_AT_name attribute for a debug information entry "die" +// and place that value into the supplied stream object. If the DIE is a NULL +// object "NULL" is placed into the stream, and if no DW_AT_name attribute +// exists for the DIE then nothing is printed. +bool DWARFDebugInfoEntry::GetName(const DWARFDIE die, Stream &s) { + if (die) { + if (die.GetDIE()->IsNULL()) { s.PutCString("NULL"); return true; } else { - const char *name = - die.GetAttributeValueAsString(cu, DW_AT_name, nullptr, true); + const char *name = die.GetDIE()->GetAttributeValueAsString( + die.GetCU(), DW_AT_name, nullptr, true); if (name) { s.PutCString(name); return true; @@ -1077,33 +1069,18 @@ // Follows the type name definition down through all needed tags to end up with // a fully qualified type name and dump the results to the supplied stream. // This is used to show the name of types given a type identifier. -bool DWARFDebugInfoEntry::AppendTypeName(const DWARFUnit *cu, - const dw_offset_t die_offset, - Stream &s) { - if (cu == NULL) { - s.PutCString("NULL"); - return false; - } - - DWARFDebugInfoEntry die; - lldb::offset_t offset = die_offset; - if (die.Extract(cu, &offset)) { - if (die.IsNULL()) { +bool DWARFDebugInfoEntry::AppendTypeName(const DWARFDIE die, Stream &s) { + if (die) { + if (die.GetDIE()->IsNULL()) { s.PutCString("NULL"); return true; } else { - const char *name = die.GetPubname(cu); + const char *name = die.GetPubname(); if (name) s.PutCString(name); else { bool result = true; - const DWARFAbbreviationDeclaration *abbrevDecl = - die.GetAbbreviationDeclarationPtr(cu, offset); - - if (abbrevDecl == NULL) - return false; - - switch (abbrevDecl->Tag()) { + switch (die.Tag()) { case DW_TAG_array_type: break; // print out a "[]" after printing the full type of the element // below @@ -1172,13 +1149,10 @@ } // Follow the DW_AT_type if possible - DWARFFormValue form_value; - if (die.GetAttributeValue(cu, DW_AT_type, form_value)) { - DWARFDIE next_die = form_value.Reference(); - result = AppendTypeName(next_die.GetCU(), next_die.GetOffset(), s); - } + if (DWARFDIE next_die = die.GetAttributeValueAsReferenceDIE(DW_AT_type)) + result = AppendTypeName(next_die, s); - switch (abbrevDecl->Tag()) { + switch (die.Tag()) { case DW_TAG_array_type: s.PutCString("[]"); break;