ccoutant / dwarf-locations

2 stars 6 forks source link

Operation expression evaluation and location descriptions. #10

Closed t-tye closed 1 year ago

t-tye commented 1 year ago

On 001-clarifications-eval.txt line 295-296 is not true until location descriptions are on the stack which does not happen until 004-locations-on-stack.txt . In DWARF 5 location description operations do not put anything on the stack, so the stack could be empty, yet the result is the last location description operation.

On 001-clarifications-eval.txt line 302 it is referring to location descriptions on the stack which does not happen until 004-locations-on-stack.txt .

It is tricky to know what to do here as it needs to define how location description operations are evaluated. One possibility is to omit mentioning how that is done and defer defining until 004-locations-on-stack.txt that is when location description and value operations get unified.

A similar issue arises at line 317 and 339 which relates to having location descriptions on the stack. Before that the rules for evaluation are more complex. There is a concept of the last location description result, and rules to empty the stack. It is unclear how DW_OP_call* works as mention in notes elsewhere. Perhaps this could be a partial explanation of expression evaluation, focusing only on values, and then 004-locations-on-stack.txt can make the description complete? Does not seem a good use of effort to define the DWARF 5 rules when 004-locations-on-stack.txt will make them obsolete.

ZaricZoran commented 1 year ago

It feels to me that at this point we need to keep values and location descriptions as a separate concepts which means there can't be any indication about what happens outside the DWARF stack.

Unless we reword this whole section to define how the end of the evaluation + evaluation kind interacts with a DWARF stack in some case and a place where location description is stored in another (which is not defined in the current DWARF spec), I don't see how we can mention this logic at all before the 004-locations-on-stack.txt part.