forked from OSchip/llvm-project
[DebugInfo]: Allow DwarfCompileUnit to have line table symbol
Previously line table symbol was represented as `DIE::value_iterator` inside `DwarfCompileUnit` and subsequent function `intStmtList` was used to create a local `MCSymbol` to initialize it. This patch removes `DIE::value_iterator` from `DwarfCompileUnit` and intoduce `MCSymbol` for representing this units symbol for `debug_line` section. As a result `applyStmtList` is also modified to utilize this. Further more a helper function `getLineTableStartSym` is also introduced to get this symbol, this would be used by clients which need to access this line table, i.e `debug_macro`. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D77489
This commit is contained in:
parent
96eb38418b
commit
0d71782f4e
|
@ -351,8 +351,6 @@ void DwarfCompileUnit::initStmtList() {
|
|||
if (CUNode->isDebugDirectivesOnly())
|
||||
return;
|
||||
|
||||
// Define start line table label for each Compile Unit.
|
||||
MCSymbol *LineTableStartSym;
|
||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||
if (DD->useSectionsAsReferences()) {
|
||||
LineTableStartSym = TLOF.getDwarfLineSection()->getBeginSymbol();
|
||||
|
@ -366,13 +364,14 @@ void DwarfCompileUnit::initStmtList() {
|
|||
// left in the skeleton CU and so not included.
|
||||
// The line table entries are not always emitted in assembly, so it
|
||||
// is not okay to use line_table_start here.
|
||||
StmtListValue =
|
||||
addSectionLabel(getUnitDie(), dwarf::DW_AT_stmt_list, LineTableStartSym,
|
||||
TLOF.getDwarfLineSection()->getBeginSymbol());
|
||||
}
|
||||
|
||||
void DwarfCompileUnit::applyStmtList(DIE &D) {
|
||||
D.addValue(DIEValueAllocator, *StmtListValue);
|
||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||
addSectionLabel(D, dwarf::DW_AT_stmt_list, LineTableStartSym,
|
||||
TLOF.getDwarfLineSection()->getBeginSymbol());
|
||||
}
|
||||
|
||||
void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin,
|
||||
|
|
|
@ -47,9 +47,9 @@ class DwarfCompileUnit final : public DwarfUnit {
|
|||
unsigned UniqueID;
|
||||
bool HasRangeLists = false;
|
||||
|
||||
/// The attribute index of DW_AT_stmt_list in the compile unit DIE, avoiding
|
||||
/// the need to search for it in applyStmtList.
|
||||
DIE::value_iterator StmtListValue;
|
||||
/// The start of the unit line section, this is also
|
||||
/// reused in appyStmtList.
|
||||
MCSymbol *LineTableStartSym;
|
||||
|
||||
/// Skeleton unit associated with this unit.
|
||||
DwarfCompileUnit *Skeleton = nullptr;
|
||||
|
@ -123,6 +123,9 @@ public:
|
|||
/// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
|
||||
void applyStmtList(DIE &D);
|
||||
|
||||
/// Get line table start symbol for this unit.
|
||||
MCSymbol *getLineTableStartSym() const { return LineTableStartSym; }
|
||||
|
||||
/// A pair of GlobalVariable and DIExpression.
|
||||
struct GlobalExpr {
|
||||
const GlobalVariable *Var;
|
||||
|
|
Loading…
Reference in New Issue