[PATCH] D95998: [Debug-Info] [NFC] use emitDwarfUnitLength to handle debug line section unit length field
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 15 07:36:22 PST 2021
shchenz updated this revision to Diff 323748.
shchenz added a comment.
1: address @ikudrin comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95998/new/
https://reviews.llvm.org/D95998
Files:
llvm/lib/MC/MCDwarf.cpp
Index: llvm/lib/MC/MCDwarf.cpp
===================================================================
--- llvm/lib/MC/MCDwarf.cpp
+++ llvm/lib/MC/MCDwarf.cpp
@@ -476,46 +476,33 @@
// Create a symbol for the end of the section (to be set when we get there).
MCSymbol *LineEndSym = context.createTempSymbol();
-
- unsigned UnitLengthBytes =
- dwarf::getUnitLengthFieldByteSize(context.getDwarfFormat());
unsigned OffsetSize = dwarf::getDwarfOffsetByteSize(context.getDwarfFormat());
- if (context.getDwarfFormat() == dwarf::DWARF64)
- // Emit DWARF64 mark.
- MCOS->emitInt32(dwarf::DW_LENGTH_DWARF64);
-
- // The length field does not include itself and, in case of the 64-bit DWARF
- // format, the DWARF64 mark.
- emitAbsValue(*MCOS,
- makeEndMinusStartExpr(context, *LineStartSym, *LineEndSym,
- UnitLengthBytes),
- OffsetSize);
+ MCOS->emitDwarfUnitLength(LineEndSym, "unit length");
// Next 2 bytes is the Version.
unsigned LineTableVersion = context.getDwarfVersion();
MCOS->emitInt16(LineTableVersion);
- // Keep track of the bytes between the very start and where the header length
- // comes out.
- unsigned PreHeaderLengthBytes = UnitLengthBytes + 2;
-
// In v5, we get address info next.
if (LineTableVersion >= 5) {
MCOS->emitInt8(context.getAsmInfo()->getCodePointerSize());
MCOS->emitInt8(0); // Segment selector; same as EmitGenDwarfAranges.
- PreHeaderLengthBytes += 2;
}
+ MCSymbol *SymWithoutUnitLength = context.createTempSymbol("debug_line_");
+
// Create a symbol for the end of the prologue (to be set when we get there).
MCSymbol *ProEndSym = context.createTempSymbol(); // Lprologue_end
// Length of the prologue, is the next 4 bytes (8 bytes for DWARF64). This is
// actually the length from after the length word, to the end of the prologue.
- emitAbsValue(*MCOS,
- makeEndMinusStartExpr(context, *LineStartSym, *ProEndSym,
- (PreHeaderLengthBytes + OffsetSize)),
- OffsetSize);
+ emitAbsValue(
+ *MCOS,
+ makeEndMinusStartExpr(context, *SymWithoutUnitLength, *ProEndSym, 0),
+ OffsetSize);
+
+ MCOS->emitLabel(SymWithoutUnitLength);
// Parameters of the state machine, are next.
MCOS->emitInt8(context.getAsmInfo()->getMinInstAlignment());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95998.323748.patch
Type: text/x-patch
Size: 2401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210215/1a9ae3e6/attachment-0001.bin>
More information about the llvm-commits
mailing list