Skip to content

Commit ed55895

Browse files
pratikasharigcbot
authored andcommitted
Emit .debug_frame even when kernel has no stack call
site Emit .debug_frame even when kernel has no stack call site so that debugger can tell it's in entry frame and backtrace can stop.
1 parent 1a2bd22 commit ed55895

File tree

4 files changed

+19
-29
lines changed

4 files changed

+19
-29
lines changed

IGC/DebugInfo/DwarfDebug.cpp

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,18 +1198,15 @@ void DwarfDebug::beginModule() {
11981198
// Prime section data.
11991199
SectionMap[Asm->GetTextSection()];
12001200

1201-
if (DwarfFrameSectionNeeded()) {
1202-
Asm->SwitchSection(Asm->GetDwarfFrameSection());
1203-
if (m_pModule->hasOrIsStackCall(*VisaDbgInfo)) {
1204-
// First stack call CIE is written out,
1205-
// next subroutine CIE if required.
1206-
offsetCIEStackCall = 0;
1207-
offsetCIESubroutine = writeStackcallCIE();
1208-
}
1209-
1210-
if (!m_pModule->getSubroutines(*VisaDbgInfo)->empty()) {
1211-
// writeSubroutineCIE();
1212-
}
1201+
Asm->SwitchSection(Asm->GetDwarfFrameSection());
1202+
if (m_pModule->getSubroutines(*VisaDbgInfo)->empty()) {
1203+
// First stack call CIE is written out,
1204+
// next subroutine CIE if required.
1205+
offsetCIEStackCall = 0;
1206+
offsetCIESubroutine = writeStackcallCIE();
1207+
} else {
1208+
// TODO: .debug_frame for subrotuines is currently unsupported.
1209+
// writeSubroutineCIE();
12131210
}
12141211
}
12151212

@@ -2408,16 +2405,14 @@ void DwarfDebug::endFunction(const Function *MF) {
24082405
constructScopeDIE(TheCU, FnScope);
24092406
LLVM_DEBUG(dbgs() << "[DwarfDebug] FnScope constructed ***\n");
24102407

2411-
if (DwarfFrameSectionNeeded()) {
2412-
Asm->SwitchSection(Asm->GetDwarfFrameSection());
2413-
if (m_pModule->hasOrIsStackCall(*VisaDbgInfo)) {
2414-
LLVM_DEBUG(dbgs() << "[DwarfDebug] writing FDEStackCall start ---\n");
2415-
writeFDEStackCall(m_pModule);
2416-
LLVM_DEBUG(dbgs() << "[DwarfDebug] writing FDEStackCall end ***\n");
2417-
} else {
2418-
LLVM_DEBUG(dbgs() << "[DwarfDebug] FDESubproutine skipped ***\n");
2419-
// writeFDESubroutine(m_pModule);
2420-
}
2408+
Asm->SwitchSection(Asm->GetDwarfFrameSection());
2409+
if (m_pModule->getSubroutines(*VisaDbgInfo)->empty()) {
2410+
LLVM_DEBUG(dbgs() << "[DwarfDebug] writing FDEStackCall start ---\n");
2411+
writeFDEStackCall(m_pModule);
2412+
LLVM_DEBUG(dbgs() << "[DwarfDebug] writing FDEStackCall end ***\n");
2413+
} else {
2414+
LLVM_DEBUG(dbgs() << "[DwarfDebug] FDESubproutine skipped ***\n");
2415+
// writeFDESubroutine(m_pModule);
24212416
}
24222417

24232418
ScopeVariables.clear();
@@ -3540,10 +3535,6 @@ void DwarfDebug::writeFDEStackCall(VISAModule *m) {
35403535
Asm->EmitInt8(byte);
35413536
}
35423537
}
3543-
bool DwarfDebug::DwarfFrameSectionNeeded() const {
3544-
return (m_pModule->hasOrIsStackCall(*VisaDbgInfo) ||
3545-
(!m_pModule->getSubroutines(*VisaDbgInfo)->empty()));
3546-
}
35473538

35483539
llvm::MCSymbol *DwarfDebug::GetLabelBeforeIp(unsigned int ip) {
35493540
auto it = LabelsBeforeIp.find(ip);

IGC/DebugInfo/DwarfDebug.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,6 @@ class DwarfDebug {
747747
uint32_t writeStackcallCIE();
748748
void writeFDESubroutine(VISAModule *m);
749749
void writeFDEStackCall(VISAModule *m);
750-
bool DwarfFrameSectionNeeded() const;
751750

752751
// Store offset of 2 CIEs, one for stack call and other for subroutines.
753752
uint32_t offsetCIEStackCall = 0;

IGC/VectorCompiler/test/DebugInfo/basic.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
; RUN: -vc-dbginfo-dumps-name-override=%basename_t \
1212
; RUN: -finalizer-opts='-generateDebugInfo' -o /dev/null
1313

14-
; RUN: llvm-dwarfdump -a dbginfo_%basename_t_test_kernel_dwarf.elf | FileCheck %s
14+
; RUN: llvm-dwarfdump -debug-info -debug-line -debug-abbrev dbginfo_%basename_t_test_kernel_dwarf.elf | FileCheck %s
1515

1616
; CHECK: .debug_abbrev contents:
1717
; CHECK: .debug_info contents:

IGC/VectorCompiler/test/DebugInfo/line_num.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
; RUN: -vc-enable-dbginfo-dumps -vc-dbginfo-dumps-name-override=%basename_t \
1111
; RUN: -finalizer-opts='-generateDebugInfo -noschedule' -o /dev/null
1212

13-
; RUN: llvm-dwarfdump -a dbginfo_%basename_t_test_kernel_dwarf.elf | FileCheck %s
13+
; RUN: llvm-dwarfdump -debug-line dbginfo_%basename_t_test_kernel_dwarf.elf | FileCheck %s
1414

1515
; CHECK: Address Line Column File ISA Discriminator Flags
1616
; CHECK: 42 0 1 0 0 is_stmt

0 commit comments

Comments
 (0)