3 ms·
But GDB is not to blame, modern compilers, with optimizations turned on, generate code that can hardly be matched back to the source code. In my experience, GD
by userbinator 9y ago
But GDB is not to blame, modern compilers, with optimizations turned on, generate code that can hardly be matched back to the source code.
In my experience, GDB should get some blame at least --- far too many times I've seen it fail on code of the form
var = foo();
where the value of var will clearly be in the return value register after executing the function call, but GDB steadfastly refuses to display var, claming it's been optimised out and unavailable. Inspecting eax/rax clearly shows the value is available.
- imglorp 9y agoSometimes turning off all the -O optimizations and making sure all the -g options are on helps with that.
- lsiebert 9y agoOf course sometimes the bug disappears if you do that :-P
- gumby 9y agoThat is more likely a bug in the compiler code that emits the debug info.
- therein 9y agoCorrect, GCC 4.4.7 is notoriously bad at that in my experience.