@@ -49,6 +49,12 @@ cl::opt<cl::boolOrDefault> AddLinkageNamesToDeclCallOrigins(
4949 " referenced by DW_AT_call_origin attributes. Enabled by default "
5050 " for -gsce debugger tuning." ));
5151
52+ static cl::opt<bool > EmitFuncLineTableOffsetsOption (
53+ " emit-func-debug-line-table-offsets" , cl::Hidden,
54+ cl::desc (" Include line table offset in function's debug info and emit end "
55+ " sequence after each function's line data." ),
56+ cl::init(false ));
57+
5258static bool AddLinkageNamesToDeclCallOriginsForTuning (const DwarfDebug *DD) {
5359 bool EnabledByDefault = DD->tuneForSCE ();
5460 if (EnabledByDefault)
@@ -511,7 +517,8 @@ void DwarfCompileUnit::addWasmRelocBaseGlobal(DIELoc *Loc, StringRef GlobalName,
511517// Find DIE for the given subprogram and attach appropriate DW_AT_low_pc
512518// and DW_AT_high_pc attributes. If there are global variables in this
513519// scope then create and insert DIEs for these variables.
514- DIE &DwarfCompileUnit::updateSubprogramScopeDIE (const DISubprogram *SP) {
520+ DIE &DwarfCompileUnit::updateSubprogramScopeDIE (const DISubprogram *SP,
521+ MCSymbol *LineTableSym) {
515522 DIE *SPDie = getOrCreateSubprogramDIE (SP, includeMinimalInlineScopes ());
516523 SmallVector<RangeSpan, 2 > BB_List;
517524 // If basic block sections are on, ranges for each basic block section has
@@ -526,11 +533,9 @@ DIE &DwarfCompileUnit::updateSubprogramScopeDIE(const DISubprogram *SP) {
526533 *DD->getCurrentFunction ()))
527534 addFlag (*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
528535
529- if (Asm->OutStreamer ->getGenerateFuncLineTableOffsets () &&
530- Asm->OutStreamer ->getCurrentFuncFirstLineStreamSym ()) {
536+ if (emitFuncLineTableOffsets () && LineTableSym) {
531537 addSectionLabel (
532- *SPDie, dwarf::DW_AT_LLVM_stmt_sequence,
533- Asm->OutStreamer ->getCurrentFuncFirstLineStreamSym (),
538+ *SPDie, dwarf::DW_AT_LLVM_stmt_sequence, LineTableSym,
534539 Asm->getObjFileLowering ().getDwarfLineSection ()->getBeginSymbol ());
535540 }
536541
@@ -1104,8 +1109,9 @@ sortLocalVars(SmallVectorImpl<DbgVariable *> &Input) {
11041109}
11051110
11061111DIE &DwarfCompileUnit::constructSubprogramScopeDIE (const DISubprogram *Sub,
1107- LexicalScope *Scope) {
1108- DIE &ScopeDIE = updateSubprogramScopeDIE (Sub);
1112+ LexicalScope *Scope,
1113+ MCSymbol *LineTableSym) {
1114+ DIE &ScopeDIE = updateSubprogramScopeDIE (Sub, LineTableSym);
11091115
11101116 if (Scope) {
11111117 assert (!Scope->getInlinedAt ());
@@ -1699,6 +1705,10 @@ bool DwarfCompileUnit::includeMinimalInlineScopes() const {
16991705 (DD->useSplitDwarf () && !Skeleton);
17001706}
17011707
1708+ bool DwarfCompileUnit::emitFuncLineTableOffsets () const {
1709+ return EmitFuncLineTableOffsetsOption;
1710+ }
1711+
17021712void DwarfCompileUnit::addAddrTableBase () {
17031713 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering ();
17041714 MCSymbol *Label = DD->getAddressPool ().getLabel ();
0 commit comments