Improper Frame Description Entry - DWARF2 debug info

Rohit Arul Raj rohitarulraj@gmail.com
Tue May 8 11:26:00 GMT 2007


Hi all,

I am working with GCC 4.1.1 for a private target. For the sample
program given below, frame description entry generated is not proper.

########             PROGRAM  #########
#include <stdio.h>

void fun();
int main()
{
  fun();
  return 0;
}

void fun()
{
  int a;
  int b, c;

  return;
}

####### Read ELF output ###############

00000010 0000001c 00000000 FDE cie=00000000 pc=00000000..00000016
  DW_CFA_advance_loc: 2 to 00000002
  DW_CFA_def_cfa_offset: 4
  DW_CFA_advance_loc: 4 to 00000006
  DW_CFA_def_cfa_offset: 8
  DW_CFA_offset: r24 at cfa-8
  DW_CFA_offset: r14 at cfa-4
  DW_CFA_advance_loc: 2 to 00000008
  DW_CFA_def_cfa_reg: r14
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00000030 00000014 00000000 FDE cie=00000000 pc=00000016..00000022
  DW_CFA_advance_loc: 2 to 00000018
  DW_CFA_def_cfa_offset: 4
  DW_CFA_offset: r14 at cfa-4
  DW_CFA_advance_loc: 2 to 0000001a
  DW_CFA_def_cfa_reg: r14

####### objdump #################3

FP - Frame Pointer, SP - Stack Pointer, RP - Return Address Reg No.
00000000 <_main>:
   0: 7e7b              STR  FP,-(SP)
   2: 7af9 0000       STR  RP,-(SP)
   6: cef0               MOV  SP,FP
   8: 618c 0000      JMP  _fun
   c: e002              MOV 0x0,D0
   e: 7af8 0000       LOAD  (SP)+,RP
  12: 7e76             LOAD  (SP)+,FP
  14: 880b             RET

00000016 <_fun>:
  16: 7e7b            STR  FP,-(SP)
  18: cef0             MOV  SP,FP
  1a: ef30             SUB 0x0c,SP
  1c: cfe0             MOV  FP,SP
  1e: 7e76            LOAD  (SP)+,FP
  20: 880b             RET



#######  Dwarf Dump Output #############
fde:
<  0><0:0x16><main><fde offset 0x10 length: 0x1c><eh offset none>
    00000000:   cfa=00(SP/t7)
    00000002:   cfa=04(SP/t7)
    00000006:   cfa=08(SP/t7) FP/t6=-4(cfa) RP/t8=-8(cfa)
    00000008:   cfa=08(FP/t6) FP/t6=-4(cfa) RP/t8=-8(cfa)
<  0><0:0xc><main><fde offset 0x30 length: 0x14><eh offset none>
    00000000:   cfa=00(SP/t7)
    00000002:   cfa=04(SP/t7) FP/t6=-4(cfa)
    00000004:   cfa=04(FP/t6) FP/t6=-4(cfa)

When looking at the dwarf dump, the starting frame address for
function "fun" is given as
<  0><0:0xc><main><fde offset 0x30 length: 0x14><eh offset none>
ideally it should have been
<  0><0x16:0x20><fun><fde offset 0x30 length: 0x14><eh offset none>

Any suggestions where to look at for these kinds of behavior?

Regards,
Rohit



More information about the Gcc mailing list