[PATCH] D49887: [DebugInfo] Add basic support for DWARF5 call site-related attributes

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 16:28:46 PDT 2018


vsk created this revision.
vsk added reviewers: JDevlieghere, dblaikie, probinson, aprantl, wolfgangp, friss.
vsk added a project: debug-info.
Herald added a subscriber: hiraditya.

DWARF v5 introduces DW_AT_call_all_calls, a subprogram attribute which
indicates that all calls (both regular and tail) within the subprogram
have call site entries. The information within these call site entries
can be used by a debugger to heuristically create synthetic tail call
frames in backtraces.

Tail calling frames go missing in backtraces because the frame of the
caller is reused by the callee. Call site information allows a debugger
to reconstruct a sequence of (tail) calls which led from one function to
another. This improves backtrace quality. There are limitations: tail
recursion isn't handled, variables within synthetic frames may not
survive to be inspected, etc. See:

  https://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=jelinek.pdf

This patch adds an IR-level flag which lowers to DW_AT_call_all_calls
(DIFlagAllCallsDescribed) and adds rudimentary DWARF generation support
for call site entries. The generated DWARF is not compliant to the
standard in a few ways:

- DW_AT_call_tail_call is not attached to tail call sites.
- For some subprogram, at most one call site entry may point to any given callee.
- Indirect calls aren't handled.
- When the debugger tuning is LLDB, the DWARF requirement is adjusted to v4.

The rationale is to save space and/or to get a quick-and-dirty prototype
in tree that we can iterate with in LLDB.

----

I'm sending this patch out now to get some early feedback from others
interested in improving backtrace quality for tail calls. I think it'd
be worthwhile to land some kind of LLVM support before the LLDB support
is prototyped. Happy to hear any concerns/suggestions or other feedback.
Thanks!

rdar://42001377


https://reviews.llvm.org/D49887

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
  llvm/include/llvm/IR/DebugInfoFlags.def
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/DebugInfo/Generic/dwarf-callsite-related-attrs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49887.157601.patch
Type: text/x-patch
Size: 19680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180726/7090b858/attachment.bin>


More information about the llvm-commits mailing list