On Tue, Jul 24, 2018 at 12:29:37PM +0200, Tom de Vries wrote: > > I wonder if it makes sense to disambiguate things from the gcc side > > by generating an empty location description for known optimized out > > values (the standard seems to explicitely call that out as a way to > > say "optimized out").
You can't emit the empty location descriptions in the middle of other expressions though, and if you have e.g. an expression that uses DW_OP_GNU_variable_size only conditionally, even if you know that the corresponding DIE doesn't have location, the containing DWARF expression could still be well defined if the condition guarding the DW_OP_GNU_variable_size isn't true. And, also, for DW_OP_GNU_variable_size DIE lookup should be performed, say you have only a declaration in the TU, but definition somewhere else, in that case the debugger should be using that other TU's definition with hopefully location description. Or if there is a global variable interposed by some other TU, again, DW_OP_GNU_variable_size should follow to whatever variable wins. Jakub