[U-Boot] compiled failed when turned off gcc optimazition

Mike Dunn mikedunn at newsguy.com
Tue Jul 2 21:40:32 CEST 2013


On 07/01/2013 12:51 PM, Wolfgang Denk wrote:
> Dear Mike Dunn,
> 
> In message <51D1C455.9010801 at newsguy.com> you wrote:
>>
>> But there's a good motivation for wanting to turn off optimization.
> 
> I disagree here.  If you are hunting down a problem, you want to be as
> close at the original code as possible.  Disabling optimization is
> such a dramatic change to the generated code that you actually debug a
> different program.


I guess it depends on what problem being debugged...  I think your point is
valid for things like tracking down race conditions or misbehaving hardware.
But for more mundane problems like logical errors in the code, optimizations get
in the way.  It would be nice to be able to experiment with optimizations off.
Just knowing that a particular problem still exists when unoptimized code is run
will provide some clues.


> 
>> Single-stepping with a debugger at the C source level is almost useless.  I've
>> since gotten better at single-stepping at the assembly level while using the
>> mixed c and assembly view of gdb.
> 
> Hm... Did you read up the documentation, say [1], and try out these
> recommendations?
> 
> [1] http://www.denx.de/wiki/view/DULG/DebuggingTricks


No, but I will.  Many thanks!
Mike



More information about the U-Boot mailing list