[all-commits] [llvm/llvm-project] 008114: [lldb/DWARF] Fix PC value for artificial tail call...

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Jun 8 05:44:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0081149f96bd62f1d1d21040ead30bfded86e8e5
      https://github.com/llvm/llvm-project/commit/0081149f96bd62f1d1d21040ead30bfded86e8e5
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-06-08 (Mon, 08 Jun 2020)

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

  Log Message:
  -----------
  [lldb/DWARF] Fix PC value for artificial tail call frames for the "GNU" case

Summary:
The way that the support for the GNU dialect of tail call frames was
implemented in 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

Reviewers: vsk, dblaikie

Subscribers: aprantl, mgrang, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D81010




More information about the All-commits mailing list