[all-commits] [llvm/llvm-project] 0e44ff: [DWARF] Add option to add linkage_names to call_or...

Orlando Cazalet-Hyams via All-commits all-commits at lists.llvm.org
Tue Apr 23 01:31:43 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0e44ffe817ae0f544199be70f468975fcc3ab5c5
      https://github.com/llvm/llvm-project/commit/0e44ffe817ae0f544199be70f468975fcc3ab5c5
  Author: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
  Date:   2024-04-23 (Tue, 23 Apr 2024)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    A llvm/test/DebugInfo/X86/call-origin-linkage-names.ll

  Log Message:
  -----------
  [DWARF] Add option to add linkage_names to call_origin declaration refs (#89640)

If -mllvm -add-linkage-names-to-external-call-origins is true then add
DW_AT_linkage_name attributes to DW_TAG_subprogram DIEs referenced by
DW_AT_call_origin attributes that would otherwise be omitted.

A debugger may use DW_TAG_call_origin attributes to determine whether any
frames in a callstack are missing due to optimisations (e.g. tail calls).

For example, say a() calls b() tail-calls c(), and you stop in your debugger
in c():

The callstack looks like this:
    c()
    a()

Looking "up" from c(), call site information can be found in a(). This includes
a DW_AT_call_origin referencing b()'s subprogram DIE, which means the call at
this call site was to b(), not c() where we are currently stopped. This
indicates b()'s frame has been lost due to optimisation (or is misleading due
to ICF).

This patch makes it easier for a debugger to check whether the referenced
DIE describes the target function or not, for example by comparing the referenced
function name to the current frame.

There's already an option to apply DW_AT_linkage_name in a targeted manner:
-dwarf-linkage-names=Abstract, which limits adding DW_AT_linkage_names to
abstract subprogram DIEs (this is default for SCE tuning).

The new flag shouldn't affect non-SCE-tuned behaviour whether it is enabled
or not because the non-SCE-tuned behaviour is to always add linkage names to
subprogram DIEs.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list