This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -g and -fvar-tracking


On Mon, Apr 23, 2018 at 10:15:57PM -0600, Sandra Loosemore wrote:
> Can somebody remind me why using -g doesn't also enable -fvar-tracking by
> default?  At least for -g2, which is supposed to emit debug information
> about local variables?  It seems kind of counterintuitive to me that
> specifying a -O option enables a pass to collect better debug information
> but specifying -g to request debuggable code doesn't.  :-S

Because var-tracking is compile time expensive and for -O0 not needed in
most cases (variable live in memory).  It would be nice to have only partial
fast var-tracking for -O0, that would track only variables that don't live
in memory or say parameters before they are assigned to their slots or
similarly VLAs before they make it into their slots.  That said, for -O0 it
would need to be really fast.

We also have -Og which is supposed to provide good debugging experience
while optimizing a little, the worst problem with that is that in -Og we
don't artificially extend lifetime of variables till end of their scope, so
if some value is not needed after some point in the middle of the scope,
then if there is no way to compute that value anymore we can't provide the
value.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]