[PATCH] D75270: [DebugInfo] Do not emit entry values for composite locations

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 09:06:45 PST 2020


dstenb created this revision.
dstenb added reviewers: djtodoro, vsk, aprantl.
dstenb added a project: debug-info.
Herald added subscribers: llvm-commits, jrtc27, fedor.sergeev, hiraditya, jyknight.
Herald added a project: LLVM.

This is a fix for PR45009.

When working on D67492 <https://reviews.llvm.org/D67492> I made DwarfExpression emit a single
DW_OP_entry_value operation covering the whole composite location
description that is produced if a register does not have a valid DWARF
number, and is instead composed of multiple register pieces. Looking
closer at the standard, I realized that that is not valid DWARF. A
DW_OP_entry_value operation's block can only be a DWARF expression or a
register location description, so it is not valid for it to hold a
composite location description like that.

See DWARFv5 sec. 2.5.1.7:

"The DW_OP_entry_value operation pushes the value that the described
 location held upon entering the current subprogram. It has two
 operands: an unsigned LEB128 length, followed by a block containing a
 DWARF expression or a register location description (see Section
 2.6.1.1.3 on page 39)."

Perhaps we instead want to emit a entry value operation per each
DW_OP_reg* operation, e.g.:

- DW_OP_entry_value(DW_OP_regx sub_reg0), DW_OP_stack_value, DW_OP_piece 8,
- DW_OP_entry_value(DW_OP_regx sub_reg1), DW_OP_stack_value, DW_OP_piece 8, [...]

The question then becomes how the call site should look; should a
composite location description be emitted there, and we then leave it up
to the debugger to match those two composite location descriptions?
Another alternative could be to emit a call site parameter entry for
each sub-register, but firstly I'm unsure if that is even valid DWARF,
and secondly it seems like that would complicate the collection of call
site values quite a bit. As far as I can tell GCC does not emit any
entry values / call sites in these cases, so we do not have something to
compare with, but the former seems like the more reasonable approach.

Currently when trying to emit a call site entry for a parameter composed
of multiple DWARF registers a (DwarfRegs.size() == 1) assert is
triggered in addMachineRegExpression(). Until the call site
representation is figured out, and until there is use for these entry
values in practice, this commit simply stops the invalid DWARF from
being emitted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75270

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
  llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75270.246973.patch
Type: text/x-patch
Size: 5718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200227/12222366/attachment.bin>


More information about the llvm-commits mailing list