Designs for better debug info in GCC

Alexandre Oliva
Tue Dec 18 08:34:00 GMT 2007

On Dec 18, 2007, Robert Dewar <> wrote:

> Alexandre Oliva wrote:
>> Yes, I've considered something along these lines, but decided against
>> it, for we can't afford for debug information to affect executable
>> code generation in any way whatsoever, and we don't want to pessimize
>> optimized code when compiling without -g just so that compiling with
>> -g would get us the same code.

> I disagree, I think it would be fine to degrade -O1 slightly to achieve
> full debuggability,

Sure.  But this is just not relevant to my project of getting GCC to
emit correct (and, ideally, as complete as possible) variable location
information, no matter what the optimization level.

My goal is not so much about aiming at a perfect debugging experience,
but rather at making sure that what the compiler encodes in debug
information actually reflects the code it produced.

This will surely benefit a future full debuggability project, of
course.  But, as much as I see value in perfect debuggability at some
new optimization level, my current task is to get correct and more
complete variable location information at vanilla-build optimization
levels, i.e., at -O2 -g.

It is possible to do much better than what we do now, and it appears
to me that it's even possible to do much better than my current plan.
But I need to get this task wrapped up before I can spend further time
figuring out how to make it even better.

In either case, it probably won't be like -O0, for optimizations are
performed that make it impossible, and I'm not supposed to sacrifice
them for the sake of better debug information.

Alexandre Oliva
FSF Latin America Board Member
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

More information about the Gcc-patches mailing list