Hi,

I have built a tool chain for m32c target using the latest sources.
I am using a third party debugger to debug the application built 
using this tool chain. However, I am not able to view the complete
call stack. It seems that the ".debug_frame" section is not 
generating the correct unwind information.

Please consider the ".debug_frame" section generated for the 
following code:

////////////////////////////////
int foo();
int foo2();

int main()
{
  int j = 23;
  j += foo();
  return 0;
}

int foo()
{
  int k = 45;
  int l = 56;
  int m = 6;    
  m += foo2();
  return (m+l+k) ;
}

int foo2()
{
  int n = 9;
  int o = 26;      
  return (n+o) ;
}
////////////////////////////////

Command used to compile the code:
m32c-elf-gcc -mcpu=r8c main.c -g -nostartfiles

Command used to display debug information:
m32c-elf-readelf -w a.out

///////////////////////////////////////////////////////////////////
The section .debug_frame contains:

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

  DW_CFA_def_cfa: r12 ofs 3
  DW_CFA_offset: r13 at cfa-3
  DW_CFA_nop
  DW_CFA_nop

00000014 00000014 00000000 FDE cie=00000000 pc=0000c000..0000c013
  DW_CFA_advance_loc: 3 to 0000c003
  DW_CFA_def_cfa_offset: 5
  DW_CFA_def_cfa_reg: r11
  DW_CFA_offset: r11 at cfa-5
  DW_CFA_nop

0000002c 00000014 00000000 FDE cie=00000000 pc=0000c013..0000c035
  DW_CFA_advance_loc: 3 to 0000c016
  DW_CFA_def_cfa_offset: 5
  DW_CFA_def_cfa_reg: r11
  DW_CFA_offset: r11 at cfa-5
  DW_CFA_nop

00000044 00000014 00000000 FDE cie=00000000 pc=0000c035..0000c04a
  DW_CFA_advance_loc: 3 to 0000c038
  DW_CFA_def_cfa_offset: 5
  DW_CFA_def_cfa_reg: r11
  DW_CFA_offset: r11 at cfa-5
  DW_CFA_nop

///////////////////////////////////////////////////////////////////

The Frame Description Entries (FDE) generated for all the functions 
are identical. The number of local variables are different in all 
the functions. Therefore the frame size allocated for every function
will be different. 
But this is not reflected in the debug information.

The stack adjustment (accounting for the local variables) is emitted
correctly in the function prologue using "enter" instruction. 
But it seems that the debug frame information for this stack 
adjustment is not emitted.

Is my understanding correct?
If yes, how can I generate the information that will account for the 
local variables?

Regards,
Ina Pandit

KPIT Cummins InfoSystems Ltd.
Pune, India
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C 
and M32C Series. The following site also offers free technical support
to its users. Visit http://www.kpitgnutools.com for details. 
Latest versions of KPIT GNU tools were released on February 6, 2007.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to