[Lldb-commits] [PATCH] D17449: Handle the case when a variable is only valid in part of the enclosing scope
Tamas Berghammer via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 22 03:26:05 PST 2016
tberghammer requested a review of this revision.
tberghammer added a comment.
There is a (minor) difference between a variable being out of scope and having no location information. Being out of scope means that the variable hasn't declared yet while having no location information means that the variable is declared, it is in scope, but it is optimized out so the debugger can't display it's value. I introduced this new dimension of data to properly represent the difference between the 2 scenario.
In case of C/C++ the difference is very small (and I am not aware of any C/C++ compiler emitting DW_AT_start_scope) but based on our understanding of the dwarf spec it is valid if a compiler emits no lexical blocks at all and specifies the scope of all variable inside a function body using DW_AT_start_scope attributes (we use this method in the android java runtime because the full scoping information is not available). In this scenario the difference between being out of scope and being optimized out is significant because we can have two variable with the same name inside a function (same lexical block) with different scoping information what will ensure that the variable names are unique at any given point of the function (assuming the dwarf information is correct).
If we want to represent this information with using a dwarf expression then we need to create a new expression value what I think is a much more intrusive change as it will modify we handle the standard dwarf expressions. In my opinion it is a much better option to introduce the scoping information as a high level concept the way I implemented it so all dwarf information (possibly) generated by the compilers can be handled correctly.
Let me know what do you think.
More information about the lldb-commits