Recording of register saves in DWARF2 CFI

James Molloy
Mon Apr 21 12:39:00 GMT 2008


I'm attempting to write a cross-platform debugger for a hobby kernel, 
and as part of which I use DWARF-2's CFI stack unwinding functionality.

This works perfectly, however I would also like to obtain the parameters 
given to each function call on the stack. I can do this easily in x86 as 
all the parameters are passed via stack, however on x64 and MIPS I'm 
having difficulty, as the first X parameters are passed via register.

The DWARF-2 specification makes allowance for this - the CFI system is 
capable of determining the value of any and every register at the start 
of any stack frame - but I have noticed that GCC doesn't record 
unwinding rules for many registers (seemingly any register not essential 
to the finding of the CFA or return address).

Is there any flag available to enable recording of every register, or, 
even better, certain registers, for every stack frame? I've grepped the 
manual to no avail.

Thanks very much,

James Molloy

More information about the Gcc-help mailing list