diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-02-24 23:58:54 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-02-24 23:58:54 +0000 |
commit | 2a213a45325e803202246f0ccdc4510e4b37abda (patch) | |
tree | 1d6ee170948a10c99edd607a65364e911d4d4e3d /lib/DebugInfo | |
parent | ec89b9fb9ed78dbb783897774e5d7bab376c169a (diff) | |
download | llvm-2a213a45325e803202246f0ccdc4510e4b37abda.tar.gz llvm-2a213a45325e803202246f0ccdc4510e4b37abda.tar.bz2 llvm-2a213a45325e803202246f0ccdc4510e4b37abda.tar.xz |
llvm-dwarfdump: Support for debug_line.dwo section for file names for type units under fission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r-- | lib/DebugInfo/DWARFContext.cpp | 11 | ||||
-rw-r--r-- | lib/DebugInfo/DWARFContext.h | 3 | ||||
-rw-r--r-- | lib/DebugInfo/DWARFDebugLine.cpp | 28 | ||||
-rw-r--r-- | lib/DebugInfo/DWARFDebugLine.h | 8 |
4 files changed, 35 insertions, 15 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index b5b75b0408..e17387b31d 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -136,6 +136,16 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) { } } + if (DumpType == DIDT_All || DumpType == DIDT_LineDwo) { + OS << "\n.debug_line.dwo contents:\n"; + unsigned stmtOffset = 0; + DataExtractor lineData(getLineDWOSection().Data, isLittleEndian(), + savedAddressByteSize); + DWARFDebugLine::DumpingState state(OS); + while (DWARFDebugLine::parsePrologue(lineData, &stmtOffset, &state.Prologue)) + state.finalize(); + } + if (DumpType == DIDT_All || DumpType == DIDT_Str) { OS << "\n.debug_str contents:\n"; DataExtractor strData(getStringSection(), isLittleEndian(), 0); @@ -645,6 +655,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : .Case("debug_gnu_pubtypes", &GnuPubTypesSection) .Case("debug_info.dwo", &InfoDWOSection.Data) .Case("debug_abbrev.dwo", &AbbrevDWOSection) + .Case("debug_line.dwo", &LineDWOSection.Data) .Case("debug_str.dwo", &StringDWOSection) .Case("debug_str_offsets.dwo", &StringOffsetDWOSection) .Case("debug_addr", &AddrSection) diff --git a/lib/DebugInfo/DWARFContext.h b/lib/DebugInfo/DWARFContext.h index 9bac69d6e5..2a534de49d 100644 --- a/lib/DebugInfo/DWARFContext.h +++ b/lib/DebugInfo/DWARFContext.h @@ -166,6 +166,7 @@ public: virtual StringRef getARangeSection() = 0; virtual StringRef getDebugFrameSection() = 0; virtual const Section &getLineSection() = 0; + virtual const Section &getLineDWOSection() = 0; virtual StringRef getStringSection() = 0; virtual StringRef getRangeSection() = 0; virtual StringRef getPubNamesSection() = 0; @@ -208,6 +209,7 @@ class DWARFContextInMemory : public DWARFContext { StringRef ARangeSection; StringRef DebugFrameSection; Section LineSection; + Section LineDWOSection; StringRef StringSection; StringRef RangeSection; StringRef PubNamesSection; @@ -238,6 +240,7 @@ public: virtual StringRef getARangeSection() { return ARangeSection; } virtual StringRef getDebugFrameSection() { return DebugFrameSection; } virtual const Section &getLineSection() { return LineSection; } + virtual const Section &getLineDWOSection() { return LineDWOSection; } virtual StringRef getStringSection() { return StringSection; } virtual StringRef getRangeSection() { return RangeSection; } virtual StringRef getPubNamesSection() { return PubNamesSection; } diff --git a/lib/DebugInfo/DWARFDebugLine.cpp b/lib/DebugInfo/DWARFDebugLine.cpp index b2c8502d57..83490b1d3f 100644 --- a/lib/DebugInfo/DWARFDebugLine.cpp +++ b/lib/DebugInfo/DWARFDebugLine.cpp @@ -18,14 +18,15 @@ using namespace dwarf; void DWARFDebugLine::Prologue::dump(raw_ostream &OS) const { OS << "Line table prologue:\n" - << format(" total_length: 0x%8.8x\n", TotalLength) - << format(" version: %u\n", Version) - << format("prologue_length: 0x%8.8x\n", PrologueLength) - << format("min_inst_length: %u\n", MinInstLength) - << format("default_is_stmt: %u\n", DefaultIsStmt) - << format(" line_base: %i\n", LineBase) - << format(" line_range: %u\n", LineRange) - << format(" opcode_base: %u\n", OpcodeBase); + << format(" total_length: 0x%8.8x\n", TotalLength) + << format(" version: %u\n", Version) + << format(" prologue_length: 0x%8.8x\n", PrologueLength) + << format(" min_inst_length: %u\n", MinInstLength) + << format(Version >= 4 ? "max_ops_per_inst: %u\n" : "", MaxOpsPerInst) + << format(" default_is_stmt: %u\n", DefaultIsStmt) + << format(" line_base: %i\n", LineBase) + << format(" line_range: %u\n", LineRange) + << format(" opcode_base: %u\n", OpcodeBase); for (uint32_t i = 0; i < StandardOpcodeLengths.size(); ++i) OS << format("standard_opcode_lengths[%s] = %u\n", LNStandardString(i+1), @@ -172,12 +173,14 @@ DWARFDebugLine::parsePrologue(DataExtractor debug_line_data, prologue->clear(); prologue->TotalLength = debug_line_data.getU32(offset_ptr); prologue->Version = debug_line_data.getU16(offset_ptr); - if (prologue->Version != 2) + if (prologue->Version < 2) return false; prologue->PrologueLength = debug_line_data.getU32(offset_ptr); const uint32_t end_prologue_offset = prologue->PrologueLength + *offset_ptr; prologue->MinInstLength = debug_line_data.getU8(offset_ptr); + if (prologue->Version >= 4) + prologue->MaxOpsPerInst = debug_line_data.getU8(offset_ptr); prologue->DefaultIsStmt = debug_line_data.getU8(offset_ptr); prologue->LineBase = debug_line_data.getU8(offset_ptr); prologue->LineRange = debug_line_data.getU8(offset_ptr); @@ -220,10 +223,9 @@ DWARFDebugLine::parsePrologue(DataExtractor debug_line_data, return true; } -bool -DWARFDebugLine::parseStatementTable(DataExtractor debug_line_data, - const RelocAddrMap *RMap, - uint32_t *offset_ptr, State &state) { +bool DWARFDebugLine::parseStatementTable(DataExtractor debug_line_data, + const RelocAddrMap *RMap, + uint32_t *offset_ptr, State &state) { const uint32_t debug_line_offset = *offset_ptr; Prologue *prologue = &state.Prologue; diff --git a/lib/DebugInfo/DWARFDebugLine.h b/lib/DebugInfo/DWARFDebugLine.h index 9e93cc86dd..88b1aee922 100644 --- a/lib/DebugInfo/DWARFDebugLine.h +++ b/lib/DebugInfo/DWARFDebugLine.h @@ -34,8 +34,9 @@ public: struct Prologue { Prologue() - : TotalLength(0), Version(0), PrologueLength(0), MinInstLength(0), - DefaultIsStmt(0), LineBase(0), LineRange(0), OpcodeBase(0) {} + : TotalLength(0), Version(0), PrologueLength(0), MinInstLength(0), + MaxOpsPerInst(0), DefaultIsStmt(0), LineBase(0), LineRange(0), + OpcodeBase(0) {} // The size in bytes of the statement information for this compilation unit // (not including the total_length field itself). @@ -49,6 +50,9 @@ public: // program opcodes that alter the address register first multiply their // operands by this value. uint8_t MinInstLength; + // The maximum number of individual operations that may be encoded in an + // instruction. + uint8_t MaxOpsPerInst; // The initial value of theis_stmtregister. uint8_t DefaultIsStmt; // This parameter affects the meaning of the special opcodes. See below. |