Debugging when optimisation is on?

Jonathan Wakely jwakely.gcc@gmail.com
Thu Dec 30 19:08:00 GMT 2010


On 30 December 2010 18:43, Name lastlong wrote:
> hi,
>
> I have a program that debugs well when I try debugging with no optimisation on. However, debugging breaks as soon as I turn on the optimization option like O2 or Os. Readelf dump shows some misaligned line numbers.

What do you mean by "breaks" ?
Just wrong line numbers?

> What could be wrong? Isnt it a good idea to debug with optmization on?
> I am using gcc 4.5.

Possibly there's nothing "wrong"

Did you read the manual?
See the docs for -g here:
http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Debugging-Options.html



More information about the Gcc-help mailing list