[Dwarf-Discuss] unwinding stack (CIE/FDE)

Saurabh saurabhcv at yahoo.com
Tue Aug 3 14:09:32 PDT 2010


Thi is a dwarf question rather than a libdwarf question. I have got away with 
that before, so I'll give this a try.

Question : I am adding bachtrace/ stack unwinding functionality in my debugger. 
I noticed FP is not used and I need to get the return address by parsing CFA. I 
went through the dwarf SPEC and the Frame example but soon got lost.

This is what I was planning to do.
1)find the relevant FDE by comparing the current IP (PC) to "initial_location" & 
"range" of all existing FDE's in the "debug_frame" section. 

2)Go to the right CIE pointed by the FDE. 
3)Read the return address register. The address contained in the register would 
be my return address.

I think my understanding is incorrect since these steps don't work as the return 
register is fixed at 31(blink) in my case. 


Do I need to parse FDE further and find the instruction saving the return 
address?

There appears to be a disconnect between conceptual matrix and the assembly 
prologue/epilogue in the example. foo+20 wasn't there in assembly nor was r8


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20100803/a548b9d6/attachment-0001.htm>


More information about the Dwarf-Discuss mailing list