[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Callstack information (again)

From: Torleif Sandnes
Subject: [avr-gcc-list] Callstack information (again)
Date: Mon, 06 Sep 2004 14:24:41 +0200
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Hi everybody.

We have a long-term goal to provide AVR Studio with the ability to understand dwarf2 callstack information. This will enable users to see what functions have been called and to view the local variables and parameters of each context just by clicking on the desired function activation.

To achieve this, it is necessary to have a compiler which produces this 

Now, I have read the relevant sections of "gcc internals" several times and managed to add some basic call stack information. I have managed this by adding some code in avr_output_function_prologue() in avr.c. This code is basically only calls to the two functions dwarf2out_def_cfa() and dwarf2out_reg_save().

Also, I have added


#define INCOMING_RETURN_ADDR_RTX gen_rtx_MEM (HImode, gen_rtx_REG(HImode, 32))

to avr.h to enable generation of dwarf callstack information.
This comes out as something like:

00000076 00000021 00000000 FDE cie=00000000 pc=00ac01a4..00ac01a8
  DW_CFA_def_cfa_reg: r28
  DW_CFA_offset_extended_sf: r14 at cfa+12
  DW_CFA_offset_extended_sf: r15 at cfa+13
  DW_CFA_offset_extended_sf: r16 at cfa+14
  DW_CFA_offset_extended_sf: r17 at cfa+15
  DW_CFA_offset_extended_sf: r28 at cfa+16
  DW_CFA_offset_extended_sf: r29 at cfa+17

for a function with some parameters.

I have not modified any of the insns that affect the stack frame.

1. I miss some dwarf callstack instructions such as DW_CFA_advance_loc.
   How can I make gcc output these?
2. Specifically, which insns should be flagged by a RTX_FRAME_RELATED note?
   Or should I rather somehow call dwarf2out_frame_debug()?
3. Does anybody intend to add this feature to avr-gcc?
4. Is there any documentation of the avr port of gcc?
5. Is it correct that R32/R33 is defined to be the stackpointer and that R36 is
   the status register?
6. What is the arg pointer? (R34/35) And when it is used? Does it concern the
   callstack information?

I am quite new to reading RTL, and I may lack some basic understanding. Please correct me if any of my assumptions are wrong or if I am asking stupid questions.


Torleif Sandnes
Atmel AVR Software Team

reply via email to

[Prev in Thread] Current Thread [Next in Thread]