Problem with gdb debug gcc

Andi Hellmund mail@andihellmund.com
Thu May 27 10:03:00 GMT 2010


Hey,

> (gdb) file ./cc1
> (gdb) run -I /usr/include /cazy/add.c 
> my problem is that ,when I creat the break point 
>  
> (gdb) break main  it worked well   (gcc/main.c) 
>  
> but 
> (gdb) break do_compile, it says  Function "do_compile" not defined.   
> (gcc/toplev.c) 

I was having the same problems, and the problem is caused by inlining. 
The function do_compile() gets inlined into toplev_main(), at least in 
an optimized build.

> so i tried to break another function toplev_main() in the same source file 
> (gdb) break toplev_main  it worked                   (gcc/toplev.c) 

Here's what I did to get inlining switched-off and to produce a 
debug-capable cc1 compiler (there might be other and possibly better 
ways :-)):

configure --disable-bootstrap [...] CFLAGS="-O0 -g -fno-inline 
-fno-inline-functions -finline-limit=0"

I think the last two inline options aren't really needed but they 
survived from previous problems. -fno-inline should be sufficient, but I 
haven't yet tested -fno-inline only.

Andi



More information about the Gcc-help mailing list