3 ms·
So, DWARF tries to provide extensive support for all possible options you can think of to do things like say "a variable is live int his range, have this value
by DannyBee 8y ago
So, DWARF tries to provide extensive support for all possible options you can think of to do things like say "a variable is live int his range, have this value in this range, and is dead in this range"
Over individual ranges, it even supports saying "this piece of the variable is in a register, this piece in memory, etc". Even at the per-bit level.
You can evaluate complex turing-complete expressions to produce the value, including calling DWARF expression subroutines
(the latter is fairly new)
GDB supports them all.
The underlying problem is multi-fold.
1. Computations get rewritten and rearranged in ways that do not affect the semantics of the program overall, but do of the intermediate states.
IE if you rewrite
a = b * 5
c = a * b
as
a = b * b
c = a * 5
assuming b = 3
the intermediate value of a is now 9
but in terms of the original code it was 15
A value of 45 probably would just confuse the programmer.
It is possible, with extensive enough tracking to solve the above problem for a significant set of cases
However, code movement and rearrangement make it not feasible to solve it in all (particularly around heavy loop optimization).
2. Variables also get partially coalesced/eliminated all the time in other interesting ways.
Turning applesauce back into apples is not possible in practice. I admit the theoretical possibility, but ...