I was wondering if I can get a list of gcc option that can cause gdb to behave strange.
Of course, we all know that using optimization options (-O3 for instance) causes weird behaviour in gdb, but what are the other options that can have such impact?
(I'm currently trying to run an mpeg2 decoder in gdb and I get weird behaviour even after removing optimization flags ...)
I think it's difficult to say what flags you should't use when calling gcc for debugging.
The gcc docs note that the default debug flags are -g
and -O2
, and using -g -O0 -fno-inline
disables any optimization and function inlining.
In my opinion, if you really want to guaratee that nothing will mess your debugging process, you just have to compile with -g -O0 -fno-inline
flags.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With