ccoutant / dwarf-locations

2 stars 6 forks source link

DW_OP_entry_value #4

Closed woodard closed 1 year ago

woodard commented 1 year ago

On 0001 lines 712-713 you have:

[non-normative] It may be used to determine the value of arguments
on entry to the current call frame provided they are not clobbered.

I believe this is only partly true as written. It can also provide the value of arguments even when they are clobbered. For example, if an argument is passed by value, then it can extract the value from the calling call frame’s location of the variable Many location list entries appear to rely on this behavior..

t-tye commented 1 year ago

I think the intent here was to define a version of this operation that was reasonably implementable, avoiding needing to save the values on every subprogram entry. Hence indicating that it can only be used if the value is not clobbered. Generally it cannot recover arguments that are passed in memory that is clobbered, or passed in non-saved registers that are clobbered. I think this was assuming that a register that is saved is not considered clobbered as there is a saved copy.

But I suggest moving any mention of DW_OP_entry_value to an independent proposal. Perhaps it would be better to remove the operation and only provide operations that can be implemented efficiently.