forked from OSchip/llvm-project
[lldb/DWARF] Remove dead code in DWARFDebugInfoEntry
The dumping code is not used by anyone, and is a source of inconsistencies with the llvm dwarf parser, as dumping is implemented at a different level (DWARFDie) there.
This commit is contained in:
parent
3834385f27
commit
283658c978
|
@ -395,145 +395,6 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges(
|
|||
return !ranges.IsEmpty();
|
||||
}
|
||||
|
||||
// Dump
|
||||
//
|
||||
// Dumps a debug information entry and all of it's attributes to the specified
|
||||
// stream.
|
||||
void DWARFDebugInfoEntry::Dump(const DWARFUnit *cu, Stream &s,
|
||||
uint32_t recurse_depth) const {
|
||||
const DWARFDataExtractor &data = cu->GetData();
|
||||
lldb::offset_t offset = m_offset;
|
||||
|
||||
if (data.ValidOffset(offset)) {
|
||||
dw_uleb128_t abbrCode = data.GetULEB128(&offset);
|
||||
|
||||
s.Printf("\n0x%8.8x: ", m_offset);
|
||||
s.Indent();
|
||||
if (abbrCode != m_abbr_idx) {
|
||||
s.Printf("error: DWARF has been modified\n");
|
||||
} else if (abbrCode) {
|
||||
const auto *abbrevDecl = GetAbbreviationDeclarationPtr(cu);
|
||||
if (abbrevDecl) {
|
||||
s.PutCString(DW_TAG_value_to_name(abbrevDecl->Tag()));
|
||||
s.Printf(" [%u] %c\n", abbrCode, abbrevDecl->HasChildren() ? '*' : ' ');
|
||||
|
||||
// Dump all data in the .debug_info/.debug_types for the attributes
|
||||
const uint32_t numAttributes = abbrevDecl->NumAttributes();
|
||||
for (uint32_t i = 0; i < numAttributes; ++i) {
|
||||
DWARFFormValue form_value(cu);
|
||||
dw_attr_t attr;
|
||||
abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value);
|
||||
|
||||
DumpAttribute(cu, data, &offset, s, attr, form_value);
|
||||
}
|
||||
|
||||
const DWARFDebugInfoEntry *child = GetFirstChild();
|
||||
if (recurse_depth > 0 && child) {
|
||||
s.IndentMore();
|
||||
|
||||
while (child) {
|
||||
child->Dump(cu, s, recurse_depth - 1);
|
||||
child = child->GetSibling();
|
||||
}
|
||||
s.IndentLess();
|
||||
}
|
||||
} else
|
||||
s.Printf("Abbreviation code note found in 'debug_abbrev' class for "
|
||||
"code: %u\n",
|
||||
abbrCode);
|
||||
} else {
|
||||
s.Printf("NULL\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DumpAttribute
|
||||
//
|
||||
// Dumps a debug information entry attribute along with it's form. Any special
|
||||
// display of attributes is done (disassemble location lists, show enumeration
|
||||
// values for attributes, etc).
|
||||
void DWARFDebugInfoEntry::DumpAttribute(
|
||||
const DWARFUnit *cu, const DWARFDataExtractor &data,
|
||||
lldb::offset_t *offset_ptr, Stream &s, dw_attr_t attr,
|
||||
DWARFFormValue &form_value) {
|
||||
bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
|
||||
|
||||
s.Printf(" ");
|
||||
s.Indent(DW_AT_value_to_name(attr));
|
||||
|
||||
if (show_form) {
|
||||
s.Printf("[%s", DW_FORM_value_to_name(form_value.Form()));
|
||||
}
|
||||
|
||||
if (!form_value.ExtractValue(data, offset_ptr))
|
||||
return;
|
||||
|
||||
if (show_form) {
|
||||
if (form_value.Form() == DW_FORM_indirect) {
|
||||
s.Printf(" [%s]", DW_FORM_value_to_name(form_value.Form()));
|
||||
}
|
||||
|
||||
s.PutCString("] ");
|
||||
}
|
||||
|
||||
s.PutCString("( ");
|
||||
|
||||
// Check to see if we have any special attribute formatters
|
||||
switch (attr) {
|
||||
case DW_AT_stmt_list:
|
||||
s.Printf("0x%8.8" PRIx64, form_value.Unsigned());
|
||||
break;
|
||||
|
||||
case DW_AT_language:
|
||||
s.PutCString(DW_LANG_value_to_name(form_value.Unsigned()));
|
||||
break;
|
||||
|
||||
case DW_AT_encoding:
|
||||
s.PutCString(DW_ATE_value_to_name(form_value.Unsigned()));
|
||||
break;
|
||||
|
||||
case DW_AT_frame_base:
|
||||
case DW_AT_location:
|
||||
case DW_AT_data_member_location: {
|
||||
const uint8_t *blockData = form_value.BlockData();
|
||||
if (blockData) {
|
||||
// Location description is inlined in data in the form value
|
||||
DWARFDataExtractor locationData(data,
|
||||
(*offset_ptr) - form_value.Unsigned(),
|
||||
form_value.Unsigned());
|
||||
DWARFExpression::PrintDWARFExpression(
|
||||
s, locationData, DWARFUnit::GetAddressByteSize(cu), 4, false);
|
||||
} else {
|
||||
// We have a location list offset as the value that is the offset into
|
||||
// the .debug_loc section that describes the value over it's lifetime
|
||||
uint64_t debug_loc_offset = form_value.Unsigned();
|
||||
DWARFExpression::PrintDWARFLocationList(s, cu, cu->GetLocationData(),
|
||||
debug_loc_offset);
|
||||
}
|
||||
} break;
|
||||
|
||||
case DW_AT_abstract_origin:
|
||||
case DW_AT_specification: {
|
||||
DWARFDIE abstract_die = form_value.Reference();
|
||||
form_value.Dump(s);
|
||||
// *ostrm_ptr << HEX32 << abstract_die.GetOffset() << " ( ";
|
||||
abstract_die.GetName(s);
|
||||
} break;
|
||||
|
||||
case DW_AT_type: {
|
||||
DWARFDIE type_die = form_value.Reference();
|
||||
s.PutCString(" ( ");
|
||||
type_die.AppendTypeName(s);
|
||||
s.PutCString(" )");
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
s.PutCString(" )\n");
|
||||
}
|
||||
|
||||
// Get all attribute values for a given DIE, including following any
|
||||
// specification or abstract origin attributes and including those in the
|
||||
// results. Any duplicate attributes will have the first instance take
|
||||
|
|
|
@ -99,15 +99,6 @@ public:
|
|||
const char *GetQualifiedName(DWARFUnit *cu, const DWARFAttributes &attributes,
|
||||
std::string &storage) const;
|
||||
|
||||
void Dump(const DWARFUnit *cu, lldb_private::Stream &s,
|
||||
uint32_t recurse_depth) const;
|
||||
|
||||
static void
|
||||
DumpAttribute(const DWARFUnit *cu,
|
||||
const lldb_private::DWARFDataExtractor &data,
|
||||
lldb::offset_t *offset_ptr, lldb_private::Stream &s,
|
||||
dw_attr_t attr, DWARFFormValue &form_value);
|
||||
|
||||
bool GetDIENamesAndRanges(
|
||||
DWARFUnit *cu, const char *&name, const char *&mangled,
|
||||
DWARFRangeList &rangeList, int &decl_file, int &decl_line,
|
||||
|
|
Loading…
Reference in New Issue