[U-Boot-Users] Compiler optimizations and debugging

llandre r&d at wawnet.biz
Thu Mar 20 18:19:07 CET 2003


> > To make the step-by-step debugging easier with GDB/DDD, I removed the
> > optimization flag "-Os" from the config.mk file. In fact, with the
> > optimization turned on, the code seems not to be executed sequentially
> > inside code window. However, without the -Os flag, the linker is unable to
>
>Well, the _optimized_ code _is_ exectued sequentially. But you cannot
>expect that a sequence of lines of  C  code  results  in  a  strictly
>sequential  sequence  of  machine  instructions. The potimizer will -
>ummm - optimize the code.

I meant that the code is apparently non-sequential.
Recently I worked with the GCC cross compiler for ARM (arm-elf-gcc) and I 
encountered the same problem. In that case the default compilation is 
usually performed with the -O2 flag but, during the debugging, we are used 
to build with the -O0 flag. This way, when you debug step-by-step, the C 
lines are executed sequentially, too. Thus, even if the code is obviously 
much larger and much slower, it is easier follow the flow of the code.
So I was wondering if it is possible to do the same thing with the 
ppc-linux-gcc compiler. Is it?


llandre





More information about the U-Boot mailing list