[PATCH] D64971: [SafeStack] Don't re-insert derefs for allocas in debug info

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 10:08:54 PDT 2019


vsk added a comment.

In D64971#1593768 <https://reviews.llvm.org/D64971#1593768>, @jmorse wrote:

> This sounds similar to PR41675 -- sometimes the DWARF expression builder interprets a DW_OP_deref as an extra dereference, other times it interprets it as confirmation that the expression being built is a memory location.
>
> I think this fix might not work with expressions that already has a DW_OP_stack_value in them. The change relies on the expression eventually being a DWARF memory location (and thus always involving a dereference); but if the rest of the original DIExpr has a stack_value in it, the expression will be an implicit location, and the desired dereference won't happen.
>
> Another fix might be to keep the dereference, but always try to add a stack_value to the expression, to make it explicitly implicit? [Ooof].


Adding a stack_value doesn't seem necessary in the motivating example, though? And it would unnecessarily disallow modifying the string `value` in a debug session. AFAICT the deref is always needed here: my understanding is that dbg.value has to describe the actual value of a variable, not its address (https://www.llvm.org/docs/LangRef.html#diexpression). I admit that keeping the deref may break the dwarf builder, but istm that indicates a bug in the dwarf builder.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64971/new/

https://reviews.llvm.org/D64971





More information about the llvm-commits mailing list