From: Zachary Turner Date: Tue, 19 Mar 2019 18:06:32 +0000 (+0000) Subject: Delete dead code. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aea09858142fec87697ca4dd22c51cef410fb97f;p=platform%2Fupstream%2Fllvm.git Delete dead code. Most of these are Dump functions that are never called, but there is one instance of entire unused classes (DWARFDebugMacinfo and DWARFDebugMacinfoEntry) which are also unreferenced in the codebase). Differential Revision: https://reviews.llvm.org/D59276 llvm-svn: 356490 --- diff --git a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt index e4badcb..2d614a6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt +++ b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt @@ -15,8 +15,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN DWARFDebugInfoEntry.cpp DWARFDebugLine.cpp DWARFDebugMacro.cpp - DWARFDebugMacinfo.cpp - DWARFDebugMacinfoEntry.cpp DWARFDebugRanges.cpp DWARFDeclContext.cpp DWARFDefines.cpp diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp index b9b0e17..d1ebe3c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp @@ -67,22 +67,6 @@ DWARFAbbreviationDeclaration::extract(const DWARFDataExtractor &data, "entry"); } -void DWARFAbbreviationDeclaration::Dump(Stream *s) const { - s->Printf("Debug Abbreviation Declaration: code = 0x%4.4x, tag = %s, " - "has_children = %s\n", - m_code, DW_TAG_value_to_name(m_tag), - DW_CHILDREN_value_to_name(m_has_children)); - - DWARFAttribute::const_iterator pos; - - for (pos = m_attributes.begin(); pos != m_attributes.end(); ++pos) - s->Printf(" attr = %s, form = %s\n", - DW_AT_value_to_name(pos->get_attr()), - DW_FORM_value_to_name(pos->get_form())); - - s->Printf("\n"); -} - bool DWARFAbbreviationDeclaration::IsValid() { return m_code != 0 && m_tag != 0; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h index 85aca03..0f0b068 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h @@ -59,7 +59,6 @@ public: extract(const lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr); bool IsValid(); - void Dump(lldb_private::Stream *s) const; bool operator==(const DWARFAbbreviationDeclaration &rhs) const; const DWARFAttribute::collection &Attributes() const { return m_attributes; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp index 63b77ff..045e061 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp @@ -171,12 +171,6 @@ size_t DWARFBaseDIE::GetAttributes(DWARFAttributes &attributes, return 0; } -void DWARFBaseDIE::Dump(lldb_private::Stream *s, - const uint32_t recurse_depth) const { - if (s && IsValid()) - m_die->Dump(GetDWARF(), GetCU(), *s, recurse_depth); -} - bool operator==(const DWARFBaseDIE &lhs, const DWARFBaseDIE &rhs) { return lhs.GetDIE() == rhs.GetDIE() && lhs.GetCU() == rhs.GetCU(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h index e23db25..e5b5bd5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h @@ -138,12 +138,6 @@ public: size_t GetAttributes(DWARFAttributes &attributes, uint32_t depth = 0) const; - //---------------------------------------------------------------------- - // Pretty printing - //---------------------------------------------------------------------- - - void Dump(lldb_private::Stream *s, const uint32_t recurse_depth) const; - protected: DWARFUnit *m_cu; DWARFDebugInfoEntry *m_die; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp index 038ad84..ef462bd 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp @@ -55,15 +55,6 @@ DWARFAbbreviationDeclarationSet::extract(const DWARFDataExtractor &data, } //---------------------------------------------------------------------- -// DWARFAbbreviationDeclarationSet::Dump() -//---------------------------------------------------------------------- -void DWARFAbbreviationDeclarationSet::Dump(Stream *s) const { - std::for_each( - m_decls.begin(), m_decls.end(), - bind2nd(std::mem_fun_ref(&DWARFAbbreviationDeclaration::Dump), s)); -} - -//---------------------------------------------------------------------- // DWARFAbbreviationDeclarationSet::GetAbbreviationDeclaration() //---------------------------------------------------------------------- const DWARFAbbreviationDeclaration * @@ -164,22 +155,6 @@ llvm::Error DWARFDebugAbbrev::parse(const DWARFDataExtractor &data) { } //---------------------------------------------------------------------- -// DWARFDebugAbbrev::Dump() -//---------------------------------------------------------------------- -void DWARFDebugAbbrev::Dump(Stream *s) const { - if (m_abbrevCollMap.empty()) { - s->PutCString("< EMPTY >\n"); - return; - } - - DWARFAbbreviationDeclarationCollMapConstIter pos; - for (pos = m_abbrevCollMap.begin(); pos != m_abbrevCollMap.end(); ++pos) { - s->Printf("Abbrev table for offset: 0x%8.8x\n", pos->first); - pos->second.Dump(s); - } -} - -//---------------------------------------------------------------------- // DWARFDebugAbbrev::GetAbbreviationDeclarationSet() //---------------------------------------------------------------------- const DWARFAbbreviationDeclarationSet * diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h index d163fa1..61d8e13 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h @@ -34,7 +34,6 @@ public: void Clear(); dw_offset_t GetOffset() const { return m_offset; } - void Dump(lldb_private::Stream *s) const; /// Extract all abbrev decls in a set. Returns llvm::ErrorSuccess() on /// success, and an appropriate llvm::Error object otherwise. @@ -66,8 +65,6 @@ public: DWARFDebugAbbrev(); const DWARFAbbreviationDeclarationSet * GetAbbreviationDeclarationSet(dw_offset_t cu_abbr_offset) const; - void Dump(lldb_private::Stream *s) const; - /// Extract all abbreviations for a particular compile unit. Returns /// llvm::ErrorSuccess() on success, and an appropriate llvm::Error object /// otherwise. diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp index 49de59c..bbca5fa 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp @@ -219,20 +219,6 @@ dw_offset_t DWARFDebugArangeSet::GetOffsetOfNextEntry() const { return m_offset + m_header.length + 4; } -void DWARFDebugArangeSet::Dump(Stream *s) const { - s->Printf("Address Range Header: length = 0x%8.8x, version = 0x%4.4x, " - "cu_offset = 0x%8.8x, addr_size = 0x%2.2x, seg_size = 0x%2.2x\n", - m_header.length, m_header.version, m_header.cu_offset, - m_header.addr_size, m_header.seg_size); - - const uint32_t hex_width = m_header.addr_size * 2; - DescriptorConstIter pos; - DescriptorConstIter end = m_arange_descriptors.end(); - for (pos = m_arange_descriptors.begin(); pos != end; ++pos) - s->Printf("[0x%*.*" PRIx64 " - 0x%*.*" PRIx64 ")\n", hex_width, hex_width, - pos->address, hex_width, hex_width, pos->end_address()); -} - class DescriptorContainsAddress { public: DescriptorContainsAddress(dw_addr_t address) : m_address(address) {} diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h index 009b58d..ca60559 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h @@ -46,7 +46,6 @@ public: void Compact(); llvm::Error extract(const lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr); - void Dump(lldb_private::Stream *s) const; dw_offset_t GetCompileUnitDIEOffset() const { return m_header.cu_offset; } dw_offset_t GetOffsetOfNextEntry() const; dw_offset_t FindAddress(dw_addr_t address) const; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp index 9b60e14..bf22ceb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp @@ -13,6 +13,7 @@ #include +#include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/Timer.h" diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h index 06969fc..78e86f3 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h @@ -57,8 +57,6 @@ public: return DW_INVALID_OFFSET; } - static void Dump(SymbolFileDWARF *dwarf2Data, lldb_private::Stream *s); - protected: RangeToDIE m_aranges; }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index f02c531..f6f5372 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -364,23 +364,6 @@ bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data, return false; } -//---------------------------------------------------------------------- -// DumpAncestry -// -// Dumps all of a debug information entries parents up until oldest and all of -// it's attributes to the specified stream. -//---------------------------------------------------------------------- -void DWARFDebugInfoEntry::DumpAncestry(SymbolFileDWARF *dwarf2Data, - const DWARFUnit *cu, - const DWARFDebugInfoEntry *oldest, - Stream &s, - uint32_t recurse_depth) const { - const DWARFDebugInfoEntry *parent = GetParent(); - if (parent && parent != oldest) - parent->DumpAncestry(dwarf2Data, cu, oldest, s, 0); - Dump(dwarf2Data, cu, s, recurse_depth); -} - static dw_offset_t GetRangesOffset(const DWARFDebugRangesBase *debug_ranges, DWARFFormValue &form_value) { if (form_value.Form() == DW_FORM_rnglistx) @@ -648,23 +631,6 @@ void DWARFDebugInfoEntry::Dump(SymbolFileDWARF *dwarf2Data, } } -void DWARFDebugInfoEntry::DumpLocation(SymbolFileDWARF *dwarf2Data, - DWARFUnit *cu, Stream &s) const { - const DWARFBaseDIE cu_die = cu->GetUnitDIEOnly(); - const char *cu_name = NULL; - if (cu_die) - cu_name = cu_die.GetName(); - const char *obj_file_name = NULL; - ObjectFile *obj_file = dwarf2Data->GetObjectFile(); - if (obj_file) - obj_file_name = - obj_file->GetFileSpec().GetFilename().AsCString(""); - const char *die_name = GetName(dwarf2Data, cu); - s.Printf("0x%8.8x/0x%8.8x: %-30s (from %s in %s)", cu->GetOffset(), - GetOffset(), die_name ? die_name : "", cu_name ? cu_name : "", - obj_file_name ? obj_file_name : ""); -} - //---------------------------------------------------------------------- // DumpAttribute // diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h index 695aa3a..9717f9a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -167,19 +167,11 @@ public: void Dump(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, lldb_private::Stream &s, uint32_t recurse_depth) const; - void DumpAncestry(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, - const DWARFDebugInfoEntry *oldest, lldb_private::Stream &s, - uint32_t recurse_depth) const; - static void DumpAttribute(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, const lldb_private::DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr, lldb_private::Stream &s, dw_attr_t attr, DWARFFormValue &form_value); - // This one dumps the comp unit name, objfile name and die offset for this die - // so the stream S. - void DumpLocation(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, - lldb_private::Stream &s) const; bool GetDIENamesAndRanges(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp index 1c0bc94..aae0b51 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp @@ -74,289 +74,6 @@ DWARFDebugLine::GetLineTable(const dw_offset_t offset) const { } //---------------------------------------------------------------------- -// DumpStateToFile -//---------------------------------------------------------------------- -static void DumpStateToFile(dw_offset_t offset, - const DWARFDebugLine::State &state, - void *userData) { - Log *log = (Log *)userData; - if (state.row == DWARFDebugLine::State::StartParsingLineTable) { - // If the row is zero we are being called with the prologue only - state.prologue->Dump(log); - log->PutCString("Address Line Column File"); - log->PutCString("------------------ ------ ------ ------"); - } else if (state.row == DWARFDebugLine::State::DoneParsingLineTable) { - // Done parsing line table - } else { - log->Printf("0x%16.16" PRIx64 " %6u %6u %6u%s\n", state.address, state.line, - state.column, state.file, state.end_sequence ? " END" : ""); - } -} - -//---------------------------------------------------------------------- -// DWARFDebugLine::DumpLineTableRows -//---------------------------------------------------------------------- -bool DWARFDebugLine::DumpLineTableRows(Log *log, SymbolFileDWARF *dwarf2Data, - dw_offset_t debug_line_offset) { - const DWARFDataExtractor &debug_line_data = dwarf2Data->get_debug_line_data(); - - if (debug_line_offset == DW_INVALID_OFFSET) { - // Dump line table to a single file only - debug_line_offset = 0; - while (debug_line_data.ValidOffset(debug_line_offset)) - debug_line_offset = - DumpStatementTable(log, debug_line_data, debug_line_offset); - } else { - // Dump line table to a single file only - DumpStatementTable(log, debug_line_data, debug_line_offset); - } - return false; -} - -//---------------------------------------------------------------------- -// DWARFDebugLine::DumpStatementTable -//---------------------------------------------------------------------- -dw_offset_t -DWARFDebugLine::DumpStatementTable(Log *log, - const DWARFDataExtractor &debug_line_data, - const dw_offset_t debug_line_offset) { - if (debug_line_data.ValidOffset(debug_line_offset)) { - lldb::offset_t offset = debug_line_offset; - log->Printf("--------------------------------------------------------------" - "--------\n" - "debug_line[0x%8.8x]\n" - "--------------------------------------------------------------" - "--------\n", - debug_line_offset); - - if (ParseStatementTable(debug_line_data, &offset, DumpStateToFile, log, nullptr)) - return offset; - else - return debug_line_offset + 1; // Skip to next byte in .debug_line section - } - - return DW_INVALID_OFFSET; -} - -//---------------------------------------------------------------------- -// DumpOpcodes -//---------------------------------------------------------------------- -bool DWARFDebugLine::DumpOpcodes(Log *log, SymbolFileDWARF *dwarf2Data, - dw_offset_t debug_line_offset, - uint32_t dump_flags) { - const DWARFDataExtractor &debug_line_data = dwarf2Data->get_debug_line_data(); - - if (debug_line_data.GetByteSize() == 0) { - log->Printf("< EMPTY >\n"); - return false; - } - - if (debug_line_offset == DW_INVALID_OFFSET) { - // Dump line table to a single file only - debug_line_offset = 0; - while (debug_line_data.ValidOffset(debug_line_offset)) - debug_line_offset = DumpStatementOpcodes(log, debug_line_data, - debug_line_offset, dump_flags); - } else { - // Dump line table to a single file only - DumpStatementOpcodes(log, debug_line_data, debug_line_offset, dump_flags); - } - return false; -} - -//---------------------------------------------------------------------- -// DumpStatementOpcodes -//---------------------------------------------------------------------- -dw_offset_t DWARFDebugLine::DumpStatementOpcodes( - Log *log, const DWARFDataExtractor &debug_line_data, - const dw_offset_t debug_line_offset, uint32_t flags) { - lldb::offset_t offset = debug_line_offset; - if (debug_line_data.ValidOffset(offset)) { - Prologue prologue; - - if (ParsePrologue(debug_line_data, &offset, &prologue)) { - log->PutCString("--------------------------------------------------------" - "--------------"); - log->Printf("debug_line[0x%8.8x]", debug_line_offset); - log->PutCString("--------------------------------------------------------" - "--------------\n"); - prologue.Dump(log); - } else { - offset = debug_line_offset; - log->Printf("0x%8.8" PRIx64 ": skipping pad byte %2.2x", offset, - debug_line_data.GetU8(&offset)); - return offset; - } - - Row row(prologue.default_is_stmt); - const dw_offset_t end_offset = debug_line_offset + prologue.total_length + - sizeof(prologue.total_length); - - assert(debug_line_data.ValidOffset(end_offset - 1)); - - while (offset < end_offset) { - const uint32_t op_offset = offset; - uint8_t opcode = debug_line_data.GetU8(&offset); - switch (opcode) { - case 0: // Extended Opcodes always start with a zero opcode followed by - { // a uleb128 length so you can skip ones you don't know about - - dw_offset_t ext_offset = offset; - dw_uleb128_t len = debug_line_data.GetULEB128(&offset); - dw_offset_t arg_size = len - (offset - ext_offset); - uint8_t sub_opcode = debug_line_data.GetU8(&offset); - // if (verbose) - // log->Printf( "Extended: <%u> %2.2x ", len, - // sub_opcode); - - switch (sub_opcode) { - case DW_LNE_end_sequence: - log->Printf("0x%8.8x: DW_LNE_end_sequence", op_offset); - row.Dump(log); - row.Reset(prologue.default_is_stmt); - break; - - case DW_LNE_set_address: { - row.address = debug_line_data.GetMaxU64(&offset, arg_size); - log->Printf("0x%8.8x: DW_LNE_set_address (0x%" PRIx64 ")", op_offset, - row.address); - } break; - - case DW_LNE_define_file: { - FileNameEntry fileEntry; - fileEntry.name = debug_line_data.GetCStr(&offset); - fileEntry.dir_idx = debug_line_data.GetULEB128(&offset); - fileEntry.mod_time = debug_line_data.GetULEB128(&offset); - fileEntry.length = debug_line_data.GetULEB128(&offset); - log->Printf("0x%8.8x: DW_LNE_define_file('%s', dir=%i, " - "mod_time=0x%8.8x, length=%i )", - op_offset, fileEntry.name, fileEntry.dir_idx, - fileEntry.mod_time, fileEntry.length); - prologue.file_names.push_back(fileEntry); - } break; - - case DW_LNE_set_discriminator: { - uint64_t discriminator = debug_line_data.GetULEB128(&offset); - log->Printf("0x%8.8x: DW_LNE_set_discriminator (0x%" PRIx64 ")", - op_offset, discriminator); - } break; - default: - log->Printf("0x%8.8x: DW_LNE_??? (%2.2x) - Skipping unknown upcode", - op_offset, opcode); - // Length doesn't include the zero opcode byte or the length itself, - // but it does include the sub_opcode, so we have to adjust for that - // below - offset += arg_size; - break; - } - } break; - - // Standard Opcodes - case DW_LNS_copy: - log->Printf("0x%8.8x: DW_LNS_copy", op_offset); - row.Dump(log); - break; - - case DW_LNS_advance_pc: { - dw_uleb128_t addr_offset_n = debug_line_data.GetULEB128(&offset); - dw_uleb128_t addr_offset = addr_offset_n * prologue.min_inst_length; - log->Printf("0x%8.8x: DW_LNS_advance_pc (0x%x)", op_offset, - addr_offset); - row.address += addr_offset; - } break; - - case DW_LNS_advance_line: { - dw_sleb128_t line_offset = debug_line_data.GetSLEB128(&offset); - log->Printf("0x%8.8x: DW_LNS_advance_line (%i)", op_offset, - line_offset); - row.line += line_offset; - } break; - - case DW_LNS_set_file: - row.file = debug_line_data.GetULEB128(&offset); - log->Printf("0x%8.8x: DW_LNS_set_file (%u)", op_offset, row.file); - break; - - case DW_LNS_set_column: - row.column = debug_line_data.GetULEB128(&offset); - log->Printf("0x%8.8x: DW_LNS_set_column (%u)", op_offset, row.column); - break; - - case DW_LNS_negate_stmt: - row.is_stmt = !row.is_stmt; - log->Printf("0x%8.8x: DW_LNS_negate_stmt", op_offset); - break; - - case DW_LNS_set_basic_block: - row.basic_block = true; - log->Printf("0x%8.8x: DW_LNS_set_basic_block", op_offset); - break; - - case DW_LNS_const_add_pc: { - uint8_t adjust_opcode = 255 - prologue.opcode_base; - dw_addr_t addr_offset = - (adjust_opcode / prologue.line_range) * prologue.min_inst_length; - log->Printf("0x%8.8x: DW_LNS_const_add_pc (0x%8.8" PRIx64 ")", - op_offset, addr_offset); - row.address += addr_offset; - } break; - - case DW_LNS_fixed_advance_pc: { - uint16_t pc_offset = debug_line_data.GetU16(&offset); - log->Printf("0x%8.8x: DW_LNS_fixed_advance_pc (0x%4.4x)", op_offset, - pc_offset); - row.address += pc_offset; - } break; - - case DW_LNS_set_prologue_end: - row.prologue_end = true; - log->Printf("0x%8.8x: DW_LNS_set_prologue_end", op_offset); - break; - - case DW_LNS_set_epilogue_begin: - row.epilogue_begin = true; - log->Printf("0x%8.8x: DW_LNS_set_epilogue_begin", op_offset); - break; - - case DW_LNS_set_isa: - row.isa = debug_line_data.GetULEB128(&offset); - log->Printf("0x%8.8x: DW_LNS_set_isa (%u)", op_offset, row.isa); - break; - - // Special Opcodes - default: - if (opcode < prologue.opcode_base) { - // We have an opcode that this parser doesn't know about, skip the - // number of ULEB128 numbers that is says to skip in the prologue's - // standard_opcode_lengths array - uint8_t n = prologue.standard_opcode_lengths[opcode - 1]; - log->Printf("0x%8.8x: Special : Unknown skipping %u ULEB128 values.", - op_offset, n); - while (n > 0) { - debug_line_data.GetULEB128(&offset); - --n; - } - } else { - uint8_t adjust_opcode = opcode - prologue.opcode_base; - dw_addr_t addr_offset = - (adjust_opcode / prologue.line_range) * prologue.min_inst_length; - int32_t line_offset = - prologue.line_base + (adjust_opcode % prologue.line_range); - log->Printf("0x%8.8x: address += 0x%" PRIx64 ", line += %i\n", - op_offset, (uint64_t)addr_offset, line_offset); - row.address += addr_offset; - row.line += line_offset; - row.Dump(log); - } - break; - } - } - return end_offset; - } - return DW_INVALID_OFFSET; -} - -//---------------------------------------------------------------------- // Parse // // Parse the entire line table contents calling callback each time a new @@ -974,26 +691,6 @@ bool DWARFDebugLine::Prologue::GetFile(uint32_t file_idx, return false; } -//---------------------------------------------------------------------- -// DWARFDebugLine::LineTable::Dump -//---------------------------------------------------------------------- -void DWARFDebugLine::LineTable::Dump(Log *log) const { - if (prologue.get()) - prologue->Dump(log); - - if (!rows.empty()) { - log->PutCString("Address Line Column File ISA Flags"); - log->PutCString( - "------------------ ------ ------ ------ --- -------------"); - Row::const_iterator pos = rows.begin(); - Row::const_iterator end = rows.end(); - while (pos != end) { - (*pos).Dump(log); - ++pos; - } - } -} - void DWARFDebugLine::LineTable::AppendRow(const DWARFDebugLine::Row &state) { rows.push_back(state); } @@ -1128,11 +825,6 @@ void DWARFDebugLine::Row::Insert(Row::collection &state_coll, } } -void DWARFDebugLine::Row::Dump(Log *log, const Row::collection &state_coll) { - std::for_each(state_coll.begin(), state_coll.end(), - bind2nd(std::mem_fun_ref(&Row::Dump), log)); -} - //---------------------------------------------------------------------- // DWARFDebugLine::State::State //---------------------------------------------------------------------- diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h index 6eda78d..4c4e0d33 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h @@ -115,7 +115,6 @@ public: void Reset(bool default_is_stmt); void Dump(lldb_private::Log *log) const; static void Insert(Row::collection &state_coll, const Row &state); - static void Dump(lldb_private::Log *log, const Row::collection &state_coll); dw_addr_t address; // The program-counter value corresponding to a machine // instruction generated by the compiler. @@ -161,7 +160,6 @@ public: } uint32_t LookupAddress(dw_addr_t address, dw_addr_t cu_high_pc) const; - void Dump(lldb_private::Log *log) const; Prologue::shared_ptr prologue; Row::collection rows; @@ -197,14 +195,6 @@ public: DISALLOW_COPY_AND_ASSIGN(State); }; - static bool DumpOpcodes( - lldb_private::Log *log, SymbolFileDWARF *dwarf2Data, - dw_offset_t line_offset = DW_INVALID_OFFSET, - uint32_t dump_flags = 0); // If line_offset is invalid, dump everything - static bool DumpLineTableRows( - lldb_private::Log *log, SymbolFileDWARF *dwarf2Data, - dw_offset_t line_offset = - DW_INVALID_OFFSET); // If line_offset is invalid, dump everything static bool ParseSupportFiles(const lldb::ModuleSP &module_sp, const lldb_private::DWARFDataExtractor &debug_line_data, @@ -219,14 +209,6 @@ public: ParseStatementTable(const lldb_private::DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr, State::Callback callback, void *userData, DWARFUnit *dwarf_cu); - static dw_offset_t - DumpStatementTable(lldb_private::Log *log, - const lldb_private::DWARFDataExtractor &debug_line_data, - const dw_offset_t line_offset); - static dw_offset_t - DumpStatementOpcodes(lldb_private::Log *log, - const lldb_private::DWARFDataExtractor &debug_line_data, - const dw_offset_t line_offset, uint32_t flags); static bool ParseStatementTable(const lldb_private::DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr, LineTable *line_table, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp deleted file mode 100644 index 45e070b..0000000 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===-- DWARFDebugMacinfo.cpp -----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "DWARFDebugMacinfo.h" - -#include "DWARFDebugMacinfoEntry.h" -#include "SymbolFileDWARF.h" - -#include "lldb/Utility/Stream.h" - -using namespace lldb_private; -using namespace std; - -DWARFDebugMacinfo::DWARFDebugMacinfo() {} - -DWARFDebugMacinfo::~DWARFDebugMacinfo() {} - -void DWARFDebugMacinfo::Dump(Stream *s, const DWARFDataExtractor &macinfo_data, - lldb::offset_t offset) { - DWARFDebugMacinfoEntry maninfo_entry; - if (macinfo_data.GetByteSize() == 0) { - s->PutCString("< EMPTY >\n"); - return; - } - if (offset == LLDB_INVALID_OFFSET) { - offset = 0; - while (maninfo_entry.Extract(macinfo_data, &offset)) - maninfo_entry.Dump(s); - } else { - if (maninfo_entry.Extract(macinfo_data, &offset)) - maninfo_entry.Dump(s); - } -} diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.h deleted file mode 100644 index 48e57b2..0000000 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.h +++ /dev/null @@ -1,25 +0,0 @@ -//===-- DWARFDebugMacinfo.h -------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef SymbolFileDWARF_DWARFDebugMacinfo_h_ -#define SymbolFileDWARF_DWARFDebugMacinfo_h_ - -#include "SymbolFileDWARF.h" - -class DWARFDebugMacinfo { -public: - DWARFDebugMacinfo(); - - ~DWARFDebugMacinfo(); - - static void Dump(lldb_private::Stream *s, - const lldb_private::DWARFDataExtractor &macinfo_data, - lldb::offset_t offset = LLDB_INVALID_OFFSET); -}; - -#endif // SymbolFileDWARF_DWARFDebugMacinfo_h_ diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp deleted file mode 100644 index ebd11ea..0000000 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp +++ /dev/null @@ -1,110 +0,0 @@ -//===-- DWARFDebugMacinfoEntry.cpp ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "DWARFDebugMacinfoEntry.h" - -#include "lldb/Utility/Stream.h" - -using namespace lldb_private; -using namespace std; - -DWARFDebugMacinfoEntry::DWARFDebugMacinfoEntry() - : m_type_code(0), m_line(0), m_op2() { - m_op2.cstr = NULL; -} - -DWARFDebugMacinfoEntry::~DWARFDebugMacinfoEntry() {} - -const char *DWARFDebugMacinfoEntry::GetCString() const { - switch (m_type_code) { - case 0: - case DW_MACINFO_start_file: - case DW_MACINFO_end_file: - return NULL; - default: - break; - } - return m_op2.cstr; -} - -void DWARFDebugMacinfoEntry::Dump(Stream *s) const { - if (m_type_code) { - s->PutCString(DW_MACINFO_value_to_name(m_type_code)); - - switch (m_type_code) { - case DW_MACINFO_define: - s->Printf(" line:%u #define %s\n", (uint32_t)m_line, m_op2.cstr); - break; - - case DW_MACINFO_undef: - s->Printf(" line:%u #undef %s\n", (uint32_t)m_line, m_op2.cstr); - break; - - default: - s->Printf(" line:%u str: '%s'\n", (uint32_t)m_line, m_op2.cstr); - break; - - case DW_MACINFO_start_file: - s->Printf(" line:%u file index: '%u'\n", (uint32_t)m_line, - (uint32_t)m_op2.file_idx); - break; - - case DW_MACINFO_end_file: - break; - } - } else { - s->PutCString(" END\n"); - } -} - -bool DWARFDebugMacinfoEntry::Extract(const DWARFDataExtractor &mac_info_data, - lldb::offset_t *offset_ptr) { - if (mac_info_data.ValidOffset(*offset_ptr)) { - m_type_code = mac_info_data.GetU8(offset_ptr); - - switch (m_type_code) { - - case DW_MACINFO_define: - case DW_MACINFO_undef: - // 2 operands: - // Arg 1: operand encodes the line number of the source line on which - // the relevant defining or undefining pre-processor directives - // appeared. - m_line = mac_info_data.GetULEB128(offset_ptr); - // Arg 2: define string - m_op2.cstr = mac_info_data.GetCStr(offset_ptr); - break; - - case DW_MACINFO_start_file: - // 2 operands: - // Op 1: line number of the source line on which the inclusion - // pre-processor directive occurred. - m_line = mac_info_data.GetULEB128(offset_ptr); - // Op 2: a source file name index to a file number in the statement - // information table for the relevant compilation unit. - m_op2.file_idx = mac_info_data.GetULEB128(offset_ptr); - break; - - case 0: // End of list - case DW_MACINFO_end_file: - // No operands - m_line = DW_INVALID_OFFSET; - m_op2.cstr = NULL; - break; - default: - // Vendor specific entries always have a ULEB128 and a string - m_line = mac_info_data.GetULEB128(offset_ptr); - m_op2.cstr = mac_info_data.GetCStr(offset_ptr); - break; - } - return true; - } else - m_type_code = 0; - - return false; -} diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.h deleted file mode 100644 index 2a60728..0000000 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.h +++ /dev/null @@ -1,41 +0,0 @@ -//===-- DWARFDebugMacinfoEntry.h --------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef SymbolFileDWARF_DWARFDebugMacinfoEntry_h_ -#define SymbolFileDWARF_DWARFDebugMacinfoEntry_h_ - -#include "SymbolFileDWARF.h" - -class DWARFDebugMacinfoEntry { -public: - DWARFDebugMacinfoEntry(); - - ~DWARFDebugMacinfoEntry(); - - uint8_t TypeCode() const { return m_type_code; } - - uint8_t GetLineNumber() const { return m_line; } - - void Dump(lldb_private::Stream *s) const; - - const char *GetCString() const; - - bool Extract(const lldb_private::DWARFDataExtractor &mac_info_data, - lldb::offset_t *offset_ptr); - -protected: -private: - uint8_t m_type_code; - dw_uleb128_t m_line; - union { - dw_uleb128_t file_idx; - const char *cstr; - } m_op2; -}; - -#endif // SymbolFileDWARF_DWARFDebugMacinfoEntry_h_ diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp index 27e4639..b4d49f2 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp @@ -411,17 +411,6 @@ const char *DW_VIS_value_to_name(uint32_t val) { return llvmstr.data(); } -const char *DW_VIRTUALITY_value_to_name(uint32_t val) { - static char invalid[100]; - llvm::StringRef llvmstr = llvm::dwarf::VirtualityString(val); - if (llvmstr.empty()) { - snprintf(invalid, sizeof(invalid), "Unknown DW_VIRTUALITY constant: 0x%x", - val); - return invalid; - } - return llvmstr.data(); -} - const char *DW_LANG_value_to_name(uint32_t val) { static char invalid[100]; llvm::StringRef llvmstr = llvm::dwarf::LanguageString(val); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.h index 3df0e72..181b460 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.h @@ -47,8 +47,6 @@ const char *DW_ACCESS_value_to_name(uint32_t val); const char *DW_VIS_value_to_name(uint32_t val); -const char *DW_VIRTUALITY_value_to_name(uint32_t val); - const char *DW_LANG_value_to_name(uint32_t val); const char *DW_ID_value_to_name(uint32_t val); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp index ab43056..de4cce8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -304,49 +304,6 @@ bool DWARFMappedHash::Header::Read(const lldb_private::DWARFDataExtractor &data, return true; } -void DWARFMappedHash::Header::Dump(lldb_private::Stream &strm, - const DIEInfo &hash_data) const { - const size_t num_atoms = header_data.atoms.size(); - for (size_t i = 0; i < num_atoms; ++i) { - if (i > 0) - strm.PutCString(", "); - - DWARFFormValue form_value(NULL, header_data.atoms[i].form); - switch (header_data.atoms[i].type) { - case eAtomTypeDIEOffset: // DIE offset, check form for encoding - strm.Printf("{0x%8.8x}", hash_data.offset); - break; - - case eAtomTypeTag: // DW_TAG value for the DIE - { - const char *tag_cstr = lldb_private::DW_TAG_value_to_name(hash_data.tag); - if (tag_cstr) - strm.PutCString(tag_cstr); - else - strm.Printf("DW_TAG_(0x%4.4x)", hash_data.tag); - } break; - - case eAtomTypeTypeFlags: // Flags from enum TypeFlags - strm.Printf("0x%2.2x", hash_data.type_flags); - if (hash_data.type_flags) { - strm.PutCString(" ("); - if (hash_data.type_flags & eTypeFlagClassIsImplementation) - strm.PutCString(" implementation"); - strm.PutCString(" )"); - } - break; - - case eAtomTypeQualNameHash: // Flags from enum TypeFlags - strm.Printf("0x%8.8x", hash_data.qualified_name_hash); - break; - - default: - strm.Printf("AtomType(0x%x)", header_data.atoms[i].type); - break; - } - } -} - DWARFMappedHash::MemoryTable::MemoryTable( lldb_private::DWARFDataExtractor &table_data, const lldb_private::DWARFDataExtractor &string_table, const char *name) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h index 3646e70..0fbb561 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h @@ -104,8 +104,6 @@ public: bool Read(const lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr, DIEInfo &hash_data) const; - - void Dump(lldb_private::Stream &strm, const DIEInfo &hash_data) const; }; // A class for reading and using a saved hash table from a block of data