Skip to content

Commit 84461bc

Browse files
jacek-galazkasys_zuul
authored andcommitted
Add control over debug location omission
Change-Id: I845e1ca877d7055b1a83defdae26b17c92064952
1 parent f574d45 commit 84461bc

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

IGC/Compiler/DebugInfo/VISADebugEmitter.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,27 @@ void DebugEmitter::Finalize(void*& pBuffer, unsigned int& size, bool finalize)
318318
}
319319
}
320320

321-
if (emptyLoc && prevSrcLoc && pFunc->getSubprogram())
321+
if (emptyLoc && prevSrcLoc)
322322
{
323-
auto scope = pFunc->getSubprogram();
323+
if (IGC_IS_FLAG_ENABLED(FillMissingDebugLocations))
324+
{
325+
if (auto scope = pFunc->getSubprogram())
326+
{
327+
auto src = m_pDwarfDebug->getOrCreateSourceID(scope->getFilename(), scope->getDirectory(), m_pStreamEmitter->GetDwarfCompileUnitID());
328+
329+
// Emit func top as line# for unattributed lines
330+
m_pStreamEmitter->EmitDwarfLocDirective(src, scope->getLine(), 0, 0, 0, 0, scope->getFilename());
331+
}
332+
}
333+
else
334+
{
335+
auto scope = prevSrcLoc->getScope();
324336
auto src = m_pDwarfDebug->getOrCreateSourceID(scope->getFilename(), scope->getDirectory(), m_pStreamEmitter->GetDwarfCompileUnitID());
325337

326-
// TODO It is workaround to not emit empty lines until we figure out a proper solution
327-
// Emit func top as line# for unattributed lines
328-
m_pStreamEmitter->EmitDwarfLocDirective(src, scope->getLine(), 0, 0, 0, 0, scope->getFilename());
338+
// Emit 0 as line# for unattributed lines
339+
m_pStreamEmitter->EmitDwarfLocDirective(src, 0, 0, 0, 0, 0, scope->getFilename());
340+
}
341+
329342
prevSrcLoc = DebugLoc();
330343
}
331344
}

IGC/common/igc_flags.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ DECLARE_IGC_REGKEY(debugString, DisablePassToggles, 0, "Disable each IGC
219219
DECLARE_IGC_REGKEY(bool, ForceStatelessForQueueT, true, "In OCL, force to use stateless memory to hold queue_t*. This is a legacy feature to be removed.", false)
220220
DECLARE_IGC_REGKEY(bool, ForceMemoryFenceBeforeEOT, false, "Forces inserting SLM or gloabal memory fence before EOT if shader writes to SLM or goblam memory respectively.", false)
221221
DECLARE_IGC_REGKEY(bool, EnableRTmaskPso, true, "Enable render target mask optimization in PSO opt", false)
222+
DECLARE_IGC_REGKEY(bool, FillMissingDebugLocations, true, "Enable emiting function entry debug location for instruction that miss DL", false)
222223

223224
DECLARE_IGC_GROUP("Shader dumping")
224225
DECLARE_IGC_REGKEY(bool, EnableCosDump, false, "Enable cos dump", true)

0 commit comments

Comments
 (0)