Simo Sorce wrote: > Kevin, have you ever debugged with -O2 ? Yes. In fact, almost always. > It's more than reasonable to want -O0. > At -O2 some code becomes really annoying to follow because gcc will > optimize away way too much of it into registers (and gdb will not print > you the values you need to see) or will make stepping a nightmare with > gdb jumping in an out of the function as it gets inlined and then some > stuff moved "out of the original function" and things like that. I know the "mad jumping" and "value optimized out" problems very well. You learn to deal with those after the initial annoyance, and it's much better than debugging totally different machine code from the production one. > I've been more than once in gdb with -O2, it is *not* pretty, nor > useful. Strange, me too (in fact, as I wrote above, that's how I normally use GDB), but I find it very useful. > debug symbols at -O2 are mostly useful to get backtraces, but if you > need to really step through with gdb in some complicated, highly > optimizable code, often it does not cut it, you have to rebuild with -O0 > to regain debuggability and sanity. You just need to get used to the jumping around. After a bunch of times, it stops bothering you. Kevin Kofler -- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct