[cfe-dev] Disabling debug mode for system headers
David Chisnall
David.Chisnall at cl.cam.ac.uk
Sat Dec 20 00:39:07 PST 2014
On 19 Dec 2014, at 22:53, Mikael Persson <mikael.s.persson at gmail.com> wrote:
> Given that typical debugging tasks don't involve digging into standard libraries or other "system-headers" (included with -isystem option), I thought that it might be a good idea for compilers to provide the option to disable debugging for anything that is from a system header
I'm not sure that I agree with this premise. Most of the time when I'm debugging C++ code, I want to be able to inspect standard library types in the debugger. The presence of debug info isn't really the problem though, it's the optimisation level.
The real problem is that it's not contained. Even if you could say 'compile this with -O0, but treat everything from the system header as -O2' then it wouldn't do you much good. Part of the reason all of that stuff is in the headers, rather than in the library, is that it benefits a lot from inlining at point of use. The code where it's inlined at -O2 would not inline it at -O0 and you wouldn't benefit from any of the post-inlining optimisations, because they're not run at -O0.
David
More information about the cfe-dev
mailing list