Skip to content

Commit

Permalink
[DWARF] Don't emit DWARF5 symbols for DWARF2/3 + non-lldb (llvm#110120)
Browse files Browse the repository at this point in the history
Modify other legacy dwarf versions to align with the dwarf4 handling
approach when determining whether to generate DWARF5 or GNU extensions.
  • Loading branch information
linsinan1995 authored Sep 27, 2024
1 parent e069434 commit d435acb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ void DwarfCompileUnit::constructAbstractSubprogramScopeDIE(
}

bool DwarfCompileUnit::useGNUAnalogForDwarf5Feature() const {
return DD->getDwarfVersion() == 4 && !DD->tuneForLLDB();
return DD->getDwarfVersion() <= 4 && !DD->tuneForLLDB();
}

dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUTag(dwarf::Tag Tag) const {
Expand Down
15 changes: 15 additions & 0 deletions llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5

## === DWARF3, tune for gdb ===
# RUN: llc -emit-call-site-info -dwarf-version 3 -debugger-tune=gdb -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call

## === DWARF3, tune for lldb ===
# RUN: llc -dwarf-version 3 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_GNU_call

## === DWARF3, tune for sce ===
# RUN: llc -emit-call-site-info -dwarf-version 3 -filetype=obj -debugger-tune=sce \
# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call

## This is based on the following reproducer:
##
## extern void fn();
Expand Down

0 comments on commit d435acb

Please sign in to comment.