Hello All,

I am working on supporting call-stack debugging information for AVR
port.  DWARF2 is already supported in gcc-4.4.3 but not call-stack
debug info. GCC internals document  refers to INCOMING_RETURN_ADDR_RTX
and RTX_FRAME_RELATED_P.  Incase of AVR, there is no link register.
Return address is stored on stack for every call instruction.

A general picture of call-stack is like this (I hope it comes out with
right indentation):

   + --------------------------------------+ <--- Frame Pointer(FP)
    | local variables                         |
    |---------------------------------------|
    |caller frame's frame pointer  |
    |---------------------------------------|
    | Return address                      |
    +--------------------------------------+



Hence the definition of INCOMING_RETURN_ADDR_RTX goes like this:

+rtx
+avr_incoming_return_addr_rtx (void)
+{
+  /* Compute return address which is stored on the stack.
+     Current stack pointer at the begining of frame, before the prologue
+     execution holds the return address. So our job is done if we get
+     the stack pointer register value which inturn points to return address
+   */
+  return gen_rtx_MEM (HImode, stack_pointer_rtx); }
+

This change gives me an ICE in dwarf2out_frame_debug_expr() while
compiling libgcc2.c as the switch in MEM case is not matched (and
therefore reaches gcc_unreachable()). Error pasted below. Please let
me know if I missed something obvious.

Error:

<snip> ... -g -O2 -mmcu=avr25 -O2  -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
-Wold-style-definition  -isystem ./include  -DDF=SF -Dinhibit_libc
-mcall-prologues -Os -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-Dinhibit_libc  -I. -I. -I../../.././gcc -I../../../../libgcc
-I../../../../libgcc/. -I../../../../libgcc/../gcc
-I../../../../libgcc/../include   -o _mulvhi3.o -MT _mulvhi3.o -MD -MP
-MF _mulvhi3.dep -DL_mulvsi3 -c ../../../../libgcc/../gcc/libgcc2.c  \
                -DLIBGCC2_UNITS_PER_WORD=2
../../../../libgcc/../gcc/libgcc2.c: In function '__mulvhi3':
../../../../libgcc/../gcc/libgcc2.c:165: internal compiler error: in
dwarf2out_frame_debug_expr, at dwarf2out.c:2323 Please submit a full
bug report,


[I have posted a somewhat modified form of the same question on
avr-gcc-list.  Owing to holiday time, the response might get delayed.
Hence here]

Anitha

Reply via email to