diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DebugInfo/DWARFDebugLine.cpp | 12 | ||||
-rw-r--r-- | lib/DebugInfo/DWARFDebugLine.h | 3 | ||||
-rw-r--r-- | lib/MC/MCDwarf.cpp | 10 |
3 files changed, 22 insertions, 3 deletions
diff --git a/lib/DebugInfo/DWARFDebugLine.cpp b/lib/DebugInfo/DWARFDebugLine.cpp index 13d09dd298..b2c8502d57 100644 --- a/lib/DebugInfo/DWARFDebugLine.cpp +++ b/lib/DebugInfo/DWARFDebugLine.cpp @@ -62,6 +62,7 @@ void DWARFDebugLine::Row::reset(bool default_is_stmt) { Column = 0; File = 1; Isa = 0; + Discriminator = 0; IsStmt = default_is_stmt; BasicBlock = false; EndSequence = false; @@ -71,7 +72,7 @@ void DWARFDebugLine::Row::reset(bool default_is_stmt) { void DWARFDebugLine::Row::dump(raw_ostream &OS) const { OS << format("0x%16.16" PRIx64 " %6u %6u", Address, Line, Column) - << format(" %6u %3u ", File, Isa) + << format(" %6u %3u %13u ", File, Isa, Discriminator) << (IsStmt ? " is_stmt" : "") << (BasicBlock ? " basic_block" : "") << (PrologueEnd ? " prologue_end" : "") @@ -85,8 +86,9 @@ void DWARFDebugLine::LineTable::dump(raw_ostream &OS) const { OS << '\n'; if (!Rows.empty()) { - OS << "Address Line Column File ISA Flags\n" - << "------------------ ------ ------ ------ --- -------------\n"; + OS << "Address Line Column File ISA Discriminator Flags\n" + << "------------------ ------ ------ ------ --- ------------- " + "-------------\n"; for (std::vector<Row>::const_iterator pos = Rows.begin(), end = Rows.end(); pos != end; ++pos) pos->dump(OS); @@ -311,6 +313,10 @@ DWARFDebugLine::parseStatementTable(DataExtractor debug_line_data, } break; + case DW_LNE_set_discriminator: + state.Discriminator = debug_line_data.getULEB128(offset_ptr); + break; + default: // 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 diff --git a/lib/DebugInfo/DWARFDebugLine.h b/lib/DebugInfo/DWARFDebugLine.h index 2990756bd7..9e93cc86dd 100644 --- a/lib/DebugInfo/DWARFDebugLine.h +++ b/lib/DebugInfo/DWARFDebugLine.h @@ -112,6 +112,9 @@ public: // An unsigned integer whose value encodes the applicable instruction set // architecture for the current instruction. uint8_t Isa; + // An unsigned integer representing the DWARF path discriminator value + // for this location. + uint32_t Discriminator; // A boolean indicating that the current instruction is the beginning of a // statement. uint8_t IsStmt:1, diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp index fe20a6d9a9..d52c7a7692 100644 --- a/lib/MC/MCDwarf.cpp +++ b/lib/MC/MCDwarf.cpp @@ -137,6 +137,7 @@ static inline void EmitDwarfLineTable(MCStreamer *MCOS, unsigned Column = 0; unsigned Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0; unsigned Isa = 0; + unsigned Discriminator = 0; MCSymbol *LastLabel = NULL; // Loop through each MCLineEntry and encode the dwarf line number table. @@ -154,6 +155,15 @@ static inline void EmitDwarfLineTable(MCStreamer *MCOS, MCOS->EmitIntValue(dwarf::DW_LNS_set_column, 1); MCOS->EmitULEB128IntValue(Column); } + if (Discriminator != it->getDiscriminator()) { + Discriminator = it->getDiscriminator(); + unsigned Size = + MCOS->getContext().getAsmInfo()->getULEB128Size(Discriminator); + MCOS->EmitIntValue(dwarf::DW_LNS_extended_op, 1); + MCOS->EmitULEB128IntValue(Size + 1); + MCOS->EmitIntValue(dwarf::DW_LNE_set_discriminator, 1); + MCOS->EmitULEB128IntValue(Discriminator); + } if (Isa != it->getIsa()) { Isa = it->getIsa(); MCOS->EmitIntValue(dwarf::DW_LNS_set_isa, 1); |