[Lldb-commits] [PATCH] D81010: [lldb/DWARF] Fix PC value for artificial tail call frames for the "GNU" case

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 2 08:14:09 PDT 2020


labath created this revision.
labath added reviewers: vsk, dblaikie.
Herald added subscribers: mgrang, aprantl.
Herald added a project: LLDB.

The way that the support for the GNU dialect of tail call frames was
implemented in D80519 <https://reviews.llvm.org/D80519> meant that the were reporting very bogus PC values
which pointed into the middle of an instruction: the -1 trick is
necessary for the address to resolve to the right function, but we
should still be reporting a more realistic PC value -- I say "realistic"
and not "real", because it's very debatable what should be the correct
PC value for frames like this.

This patch achieves that my moving the -1 from SymbolFileDWARF into the
stack frame computation code. The idea is that SymbolFileDWARF will
merely report whether it has provided an address of the instruction
after the tail call, or the address of the call instruction itself. The
StackFrameList machinery uses this information to set the "behaves like
frame zero" property of the artificial frames (the main thing this flag
does is it controls the -1 subtraction when looking up the function
address).

This required a moderate refactor of the CallEdge class, because it was
implicitly assuming that edges pointing after the call were real calls
and those pointing the the call insn were tail calls. The class now
carries this information explicitly -- it carries three mostly
independent pieces of information:

- an address of interest in the caller
- a bit saying whether this address points to the call insn or after it
- whether this is a tail call


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81010

Files:
  lldb/include/lldb/Symbol/Function.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Target/StackFrameList.cpp
  lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81010.267888.patch
Type: text/x-patch
Size: 14826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200602/b4b7260a/attachment-0001.bin>


More information about the lldb-commits mailing list