Skip to content

Commit 283658c

Browse files
committed
[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.
1 parent 3834385 commit 283658c

File tree

2 files changed

+0
-148
lines changed

2 files changed

+0
-148
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

-139
Original file line numberDiff line numberDiff line change
@@ -395,145 +395,6 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges(
395395
return !ranges.IsEmpty();
396396
}
397397

398-
// Dump
399-
//
400-
// Dumps a debug information entry and all of it's attributes to the specified
401-
// stream.
402-
void DWARFDebugInfoEntry::Dump(const DWARFUnit *cu, Stream &s,
403-
uint32_t recurse_depth) const {
404-
const DWARFDataExtractor &data = cu->GetData();
405-
lldb::offset_t offset = m_offset;
406-
407-
if (data.ValidOffset(offset)) {
408-
dw_uleb128_t abbrCode = data.GetULEB128(&offset);
409-
410-
s.Printf("\n0x%8.8x: ", m_offset);
411-
s.Indent();
412-
if (abbrCode != m_abbr_idx) {
413-
s.Printf("error: DWARF has been modified\n");
414-
} else if (abbrCode) {
415-
const auto *abbrevDecl = GetAbbreviationDeclarationPtr(cu);
416-
if (abbrevDecl) {
417-
s.PutCString(DW_TAG_value_to_name(abbrevDecl->Tag()));
418-
s.Printf(" [%u] %c\n", abbrCode, abbrevDecl->HasChildren() ? '*' : ' ');
419-
420-
// Dump all data in the .debug_info/.debug_types for the attributes
421-
const uint32_t numAttributes = abbrevDecl->NumAttributes();
422-
for (uint32_t i = 0; i < numAttributes; ++i) {
423-
DWARFFormValue form_value(cu);
424-
dw_attr_t attr;
425-
abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value);
426-
427-
DumpAttribute(cu, data, &offset, s, attr, form_value);
428-
}
429-
430-
const DWARFDebugInfoEntry *child = GetFirstChild();
431-
if (recurse_depth > 0 && child) {
432-
s.IndentMore();
433-
434-
while (child) {
435-
child->Dump(cu, s, recurse_depth - 1);
436-
child = child->GetSibling();
437-
}
438-
s.IndentLess();
439-
}
440-
} else
441-
s.Printf("Abbreviation code note found in 'debug_abbrev' class for "
442-
"code: %u\n",
443-
abbrCode);
444-
} else {
445-
s.Printf("NULL\n");
446-
}
447-
}
448-
}
449-
450-
// DumpAttribute
451-
//
452-
// Dumps a debug information entry attribute along with it's form. Any special
453-
// display of attributes is done (disassemble location lists, show enumeration
454-
// values for attributes, etc).
455-
void DWARFDebugInfoEntry::DumpAttribute(
456-
const DWARFUnit *cu, const DWARFDataExtractor &data,
457-
lldb::offset_t *offset_ptr, Stream &s, dw_attr_t attr,
458-
DWARFFormValue &form_value) {
459-
bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
460-
461-
s.Printf(" ");
462-
s.Indent(DW_AT_value_to_name(attr));
463-
464-
if (show_form) {
465-
s.Printf("[%s", DW_FORM_value_to_name(form_value.Form()));
466-
}
467-
468-
if (!form_value.ExtractValue(data, offset_ptr))
469-
return;
470-
471-
if (show_form) {
472-
if (form_value.Form() == DW_FORM_indirect) {
473-
s.Printf(" [%s]", DW_FORM_value_to_name(form_value.Form()));
474-
}
475-
476-
s.PutCString("] ");
477-
}
478-
479-
s.PutCString("( ");
480-
481-
// Check to see if we have any special attribute formatters
482-
switch (attr) {
483-
case DW_AT_stmt_list:
484-
s.Printf("0x%8.8" PRIx64, form_value.Unsigned());
485-
break;
486-
487-
case DW_AT_language:
488-
s.PutCString(DW_LANG_value_to_name(form_value.Unsigned()));
489-
break;
490-
491-
case DW_AT_encoding:
492-
s.PutCString(DW_ATE_value_to_name(form_value.Unsigned()));
493-
break;
494-
495-
case DW_AT_frame_base:
496-
case DW_AT_location:
497-
case DW_AT_data_member_location: {
498-
const uint8_t *blockData = form_value.BlockData();
499-
if (blockData) {
500-
// Location description is inlined in data in the form value
501-
DWARFDataExtractor locationData(data,
502-
(*offset_ptr) - form_value.Unsigned(),
503-
form_value.Unsigned());
504-
DWARFExpression::PrintDWARFExpression(
505-
s, locationData, DWARFUnit::GetAddressByteSize(cu), 4, false);
506-
} else {
507-
// We have a location list offset as the value that is the offset into
508-
// the .debug_loc section that describes the value over it's lifetime
509-
uint64_t debug_loc_offset = form_value.Unsigned();
510-
DWARFExpression::PrintDWARFLocationList(s, cu, cu->GetLocationData(),
511-
debug_loc_offset);
512-
}
513-
} break;
514-
515-
case DW_AT_abstract_origin:
516-
case DW_AT_specification: {
517-
DWARFDIE abstract_die = form_value.Reference();
518-
form_value.Dump(s);
519-
// *ostrm_ptr << HEX32 << abstract_die.GetOffset() << " ( ";
520-
abstract_die.GetName(s);
521-
} break;
522-
523-
case DW_AT_type: {
524-
DWARFDIE type_die = form_value.Reference();
525-
s.PutCString(" ( ");
526-
type_die.AppendTypeName(s);
527-
s.PutCString(" )");
528-
} break;
529-
530-
default:
531-
break;
532-
}
533-
534-
s.PutCString(" )\n");
535-
}
536-
537398
// Get all attribute values for a given DIE, including following any
538399
// specification or abstract origin attributes and including those in the
539400
// results. Any duplicate attributes will have the first instance take

lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

-9
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,6 @@ class DWARFDebugInfoEntry {
9999
const char *GetQualifiedName(DWARFUnit *cu, const DWARFAttributes &attributes,
100100
std::string &storage) const;
101101

102-
void Dump(const DWARFUnit *cu, lldb_private::Stream &s,
103-
uint32_t recurse_depth) const;
104-
105-
static void
106-
DumpAttribute(const DWARFUnit *cu,
107-
const lldb_private::DWARFDataExtractor &data,
108-
lldb::offset_t *offset_ptr, lldb_private::Stream &s,
109-
dw_attr_t attr, DWARFFormValue &form_value);
110-
111102
bool GetDIENamesAndRanges(
112103
DWARFUnit *cu, const char *&name, const char *&mangled,
113104
DWARFRangeList &rangeList, int &decl_file, int &decl_line,

0 commit comments

Comments
 (0)