This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/17994] avr-gcc does not output a dwarf2 .debug_frame section


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17994

--- Comment #6 from Anitha Boyapati <anitha.boyapati at atmel dot com> 2010-12-29 13:35:34 UTC ---
(In reply to comment #4)

> Looks like to get call-stack debug info, all we require to do is define
> INCOMING_RETURN_ADDR_RTX. In AVR, since the return address is pushed onto the
> stack for every call instruction, the above hook is defined to
> avr_incoming_return_addr_rtx() of dwarf2out.c:
> 
> rtx
> avr_incoming_return_addr_rtx(void) {
> 
>     return gen_rtx_MEM (HImode, stack_pointer_rtx);
> }
> 
> And this gives an ICE in dwarf2out_frame_debug_expr(). Modifying the above
> function to pre decrement the stack pointer gives an ICE in
> initial_return_save()
> 

The reason for ICE is that POST_DEC is not handled in
dwarf2out_frame_debug_expr(). Fixing that issue will enable the compiler to
generate the call-stack debug info.

http://gcc.gnu.org/ml/gcc/2010-12/msg00474.html

#simple testcase:
void foo(){ return ;}
int main() { foo(); return 1; }


The output of .debug_frame section for the above testcase(just assembled):

00000000 00000010 ffffffff CIE
  Version:               1
  Augmentation:          ""
  Code alignment factor: 1
  Data alignment factor: -1
  Return address column: 36

  DW_CFA_def_cfa: r32 ofs 2
  DW_CFA_offset: r36 at cfa+0
  DW_CFA_nop
  DW_CFA_nop

00000014 00000014 00000000 FDE cie=00000000 pc=00000000..0000000e
  DW_CFA_advance_loc: 4 to 00000004
  DW_CFA_offset: r28 at cfa+0
  DW_CFA_advance_loc: 4 to 00000008
  DW_CFA_def_cfa_register: r28
  DW_CFA_nop
  DW_CFA_nop

0000002c 00000014 00000000 FDE cie=00000000 pc=0000000e..00000022
  DW_CFA_advance_loc: 4 to 00000012
  DW_CFA_offset: r28 at cfa+0
  DW_CFA_advance_loc: 4 to 00000016
  DW_CFA_def_cfa_register: r28
  DW_CFA_nop
  DW_CFA_nop

Comments on correctness appreciated :)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]