stack unwinding in dwarf2
I don't understand that how the stack unwinding in dwarf2 ensures reliable recovery of arguments in some very basic ABI(Application Binary Interface) scenarios. Consider a ABI, which says that the first three arguments have to be on registers and rest on stack. As I understand the dwarf2 stack unwinding mechanism ensures that if the CFI table is filled properly, one can get the values of registers at the call point of current frame. This, however, doesn't let you to go up to the prologue of caller and know 开发者_StackOverflow社区what were the contents of argument registers. So, I think there should have been a way to find the values of registers even in the same frame at different points (the table encoded in .debug_frame section only gives the locations in the previous frame).
Is there anything wrong in my understanding? How do debuggers based on dwarf2 debugging formats work in such cases? For the architectures where arguments are passed on stack, there will not be any issue to recover the values at all points in program (for any frame).
I think my understanding wasn't correct at that time. The way stack unwinding works in dwarf2 is by using Call Frame Information (CFI). This will let debugger create the state of one of the previous frames. The location expressions for that frame will let debugger know about the location of the arguments.
精彩评论