@@ -934,6 +934,7 @@ DwarfCompileUnit::getDwarf5OrGNUAttr(dwarf::Attribute Attr) const {
934
934
case dwarf::DW_AT_call_origin:
935
935
return dwarf::DW_AT_abstract_origin;
936
936
case dwarf::DW_AT_call_pc:
937
+ case dwarf::DW_AT_call_return_pc:
937
938
return dwarf::DW_AT_low_pc;
938
939
case dwarf::DW_AT_call_value:
939
940
return dwarf::DW_AT_GNU_call_site_value;
@@ -982,12 +983,13 @@ DIE &DwarfCompileUnit::constructCallSiteEntryDIE(DIE &ScopeDIE,
982
983
983
984
// Attach the return PC to allow the debugger to disambiguate call paths
984
985
// from one function to another.
985
- if (DD-> getDwarfVersion () == 4 && DD-> tuneForGDB ()) {
986
- assert (PCAddr && " Missing PC information for a call" );
987
- addLabelAddress (CallSiteDIE, dwarf::DW_AT_low_pc, PCAddr);
988
- } else if (!IsTail || DD->tuneForGDB ()) {
986
+ //
987
+ // The return PC is only really needed when the call /isn't/ a tail call, but
988
+ // for some reason GDB always expects it.
989
+ if (!IsTail || DD->tuneForGDB ()) {
989
990
assert (PCAddr && " Missing return PC information for a call" );
990
- addLabelAddress (CallSiteDIE, dwarf::DW_AT_call_return_pc, PCAddr);
991
+ addLabelAddress (CallSiteDIE,
992
+ getDwarf5OrGNUAttr (dwarf::DW_AT_call_return_pc), PCAddr);
991
993
}
992
994
993
995
return CallSiteDIE;
0 commit comments