diff options
author | Vedant Kumar <vsk@apple.com> | 2018-10-22 21:44:21 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-10-22 21:44:21 +0000 |
commit | 74533bd3b80c9e57940e06579b162c7db67d5b9d (patch) | |
tree | 7e450efbe51936dfecb72196af0a0d837f09f476 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | |
parent | dd1c3df72d33c426d08d20dc0f08b53a9075a7d4 (diff) | |
download | bcm5719-llvm-74533bd3b80c9e57940e06579b162c7db67d5b9d.tar.gz bcm5719-llvm-74533bd3b80c9e57940e06579b162c7db67d5b9d.zip |
[DWARF] Use a function-local offset for AT_call_return_pc
Logs provided by @stella.stamenova indicate that on Linux, lldb adds a
spurious slide offset to the return PC it loads from AT_call_return_pc
attributes (see the list thread: "[PATCH] D50478: Add support for
artificial tail call frames").
This patch side-steps the issue by getting rid of the load address
calculation in lldb's CallEdge::GetReturnPCAddress.
The idea is to have the DWARF writer emit function-local offsets to the
instruction after a call. I.e. return-pc = label-after-call-insn -
function-entry. LLDB can simply add this offset to the base address of a
function to get the return PC.
Differential Revision: https://reviews.llvm.org/D53469
llvm-svn: 344960
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 97a944e9b95..13679c37fe5 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -210,10 +210,10 @@ public: /// Construct a call site entry DIE describing a call within \p Scope to a /// callee described by \p CalleeSP. \p IsTail specifies whether the call is - /// a tail call. \p ReturnPC must be non-null for non-tail calls and point - /// to the PC value after the call returns. + /// a tail call. \p PCOffset must be non-zero for non-tail calls or be the + /// function-local offset to PC value after the call instruction. DIE &constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram &CalleeSP, - bool IsTail, const MCSymbol *ReturnPC); + bool IsTail, const MCExpr *PCOffset); /// Construct import_module DIE. DIE *constructImportedEntityDIE(const DIImportedEntity *Module); @@ -292,6 +292,9 @@ public: /// Add a Dwarf expression attribute data and value. void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr); + /// Add an attribute containing an address expression to \p Die. + void addAddressExpr(DIE &Die, dwarf::Attribute Attribute, const MCExpr *Expr); + void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie); |