Debugging with gdb

Russell Shaw rjshaw@netspace.net.au
Sun Jan 2 07:39:00 GMT 2005


Ian Lance Taylor wrote:
> Russell Shaw <rjshaw@netspace.net.au> writes:
> 
>>Now just need to find where cc1 is called from within in gcc/gcc.c
>>(not really trivial).
> 
> 
> Don't worry about it.  Run gcc with -v --save-temps, and you will see
> precisely how cc1 is run.
> 
> See
>     http://www.dberlin.org/gccwiki/index.php/DebuggingGCC
>     http://gcc.gnu.org/ml/gcc/2004-03/msg01195.html
> 
> Ian

Hi,
Cc1 runs ok at the command line:

   /usr/local/libexec/gcc/avr/3.4.3/cc1 -quiet -v main.c -quiet -dumpbase main.c -dP -mmcu=atmega16
-auxbase main -g -O0 -Wall -Wno-unused -version -o /tmp/cccVrfqY.s

When i try to run the same thing in gdb, it crashes:

   Program received signal SIGSEGV, Segmentation fault.
   0x080f3cd1 in init_emit () at ../../gcc-3.4.3/gcc/emit-rtl.c:5354
   /home/russell/SRC/gcc-3.4.3/gcc/emit-rtl.c:5354:138102:beg:0x80f3cd1
   (gdb)

It crashes in emit-rtl.c in init_emit():

   /* Indicate that the virtual registers and stack locations are
      all pointers.  */
   REG_POINTER (stack_pointer_rtx) = 1;

I'm trying to step thru backend rtl code to debug or optimize it.
I might make a new port some time.



More information about the Gcc mailing list