2 ms·
It's been a couple of decades since I was involved with DWARF (via bfd) but it's a static description language, even version 5 which I just looked over. In the
by gumby 8y ago
It's been a couple of decades since I was involved with DWARF (via bfd) but it's a static description language, even version 5 which I just looked over.
In theory you could provide code to run at runtime to figure out what a variable's value would have been had it not been optimized away. Instead of putting an executable language into DWARF the compiler could emit helper functions to be called by the debugger on arguments (pc, source line, some predecessor values). These could be emitted in an executable section stripped when the debugging info is stripped. The compiler actually has all the info it needs to generate such functions, but writing this code would be quite tedious.
gcc's debugging of optimized code is good enough that I pretty much always debug -g -O3 -... -- my bugs are rarely so subtle that this would obscure a problem!