compiling gcc in debug

Georg-Johann Lay avr@gjlay.de
Mon Apr 6 14:24:00 GMT 2009


Vincent R. schrieb:
> Hi,
> 
> When debugging gcc, debugger sometimes seems mad because it jumps from one
> place to another
> maybe due to the fact that some functions are inlined.
> How can I build a gcc in debug mode id without -O2 ?
> 
> In gcc Makefile I can see that :
>  
> CFLAGS_FOR_BUILD = -g -O2
> CXXFLAGS_FOR_BUILD = -g -O2
> BOOT_CFLAGS= -g -O2
> 
> Maybe I need to pass some flags to configure ?


You can use make cc1 CFLAGS='-O0 -g' in gcc directory, resp. for  cc1plus.

It is also helpful to strip the #line notes from the generated C-files 
(insn-emit.c, insn-recog.c, ...), because these notes confuse the 
debugger as they point to md.

Georg-Johann



More information about the Gcc-help mailing list