[llvm] 4346450 - DWARF: Simplify the way the return PC is attached to call site tags, NFC
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 14:20:25 PST 2020
Author: Vedant Kumar
Date: 2020-01-15T14:16:21-08:00
New Revision: 43464509fcedef667aee17b74c19cc08b65aa0ae
URL: https://github.com/llvm/llvm-project/commit/43464509fcedef667aee17b74c19cc08b65aa0ae
DIFF: https://github.com/llvm/llvm-project/commit/43464509fcedef667aee17b74c19cc08b65aa0ae.diff
LOG: DWARF: Simplify the way the return PC is attached to call site tags, NFC
This cleanup was suggested by Djordje in D72489.
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 8f42c91d3dd5..1fbffc1939eb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -934,6 +934,7 @@ DwarfCompileUnit::getDwarf5OrGNUAttr(dwarf::Attribute Attr) const {
case dwarf::DW_AT_call_origin:
return dwarf::DW_AT_abstract_origin;
case dwarf::DW_AT_call_pc:
+ case dwarf::DW_AT_call_return_pc:
return dwarf::DW_AT_low_pc;
case dwarf::DW_AT_call_value:
return dwarf::DW_AT_GNU_call_site_value;
@@ -982,12 +983,13 @@ DIE &DwarfCompileUnit::constructCallSiteEntryDIE(DIE &ScopeDIE,
// Attach the return PC to allow the debugger to disambiguate call paths
// from one function to another.
- if (DD->getDwarfVersion() == 4 && DD->tuneForGDB()) {
- assert(PCAddr && "Missing PC information for a call");
- addLabelAddress(CallSiteDIE, dwarf::DW_AT_low_pc, PCAddr);
- } else if (!IsTail || DD->tuneForGDB()) {
+ //
+ // The return PC is only really needed when the call /isn't/ a tail call, but
+ // for some reason GDB always expects it.
+ if (!IsTail || DD->tuneForGDB()) {
assert(PCAddr && "Missing return PC information for a call");
- addLabelAddress(CallSiteDIE, dwarf::DW_AT_call_return_pc, PCAddr);
+ addLabelAddress(CallSiteDIE,
+ getDwarf5OrGNUAttr(dwarf::DW_AT_call_return_pc), PCAddr);
}
return CallSiteDIE;
More information about the llvm-commits
mailing list