[PATCH] D35994: Debug info for variables whose type is shrinked to bool
Nikola Prica via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 28 09:21:04 PDT 2017
NikolaPrica marked an inline comment as done.
NikolaPrica added a comment.
>>
>>
>> val * (ValOther - ValInit) + ValInit:
>
> If we are doing this expression, there should be an assertion in the code that `ValInit < ValOther`.
I have tested this for edge cases such as both negative values, LONG_MAX, LONG_INT etc and there was no problem for this values. Only flaw for this is ugly long DW_AT_location expression for long values.
>> DW_OP_deref DW_OP_constu <ValMinus>
>> DW_OP_mul DW_OP_constu <ValInit> DW_OP_plus DW_OP_stack_value
>
> Why does `Val` need to be dereferenced?
DW_OP_deref needs to be used because we have address of new variable on stack, not its value.
> Apart from the DW_OP_deref, this seems very good, I'm slightly worried about the assumption that the init value will always be the smaller one.
> What happens if any of the two values is negative (because of the typeless DWARF <5 expression stack — not sure if this will be a problem).
For dwarf versions lower than 4 gdb reads value of DW_AT_location expression as address giving message "Cannot access memory at address 0x1e". This may be a problem but it is still better than optimized-out?
https://reviews.llvm.org/D35994
More information about the llvm-commits
mailing list