This is the mail archive of the
mailing list for the GCC project.
Re: x86_64 unwinder in libgcc_s
On Thu, Aug 16, 2012 at 1:10 AM, Dmitri Shubin <email@example.com> wrote:
> On 14.08.2012 17:58, Ian Lance Taylor wrote:
>> unwinder is right and libgcc_s one is wrong.
>> I think the definition of _Unwind_GetCFA is ambiguous. It says "the
>> value of %rsp at the call site in the previous frame." GCC is
>> returning the value of %rsp at the point of the call to throw.
>> Solaris is returning the value of %rsp at the call to foo. I don't
>> know which is correct. _Unwind_GetCFA is not part of the C++
>> exception handling ABI; I'm not sure where it came from.
> _Unwind_GetCFA() is defined in x86_64 psABI:
> "6.2 Unwind Library Interface"
I know that, but I don't know where they got it from. I don't know
why they would have made up this function for x86_64, but perhaps that
is what they did.
Either way, I find "the value of %rsp at the call site in the previous
frame" to be an ambiguous description. Which frame is "the previous
frame?" The frame that calls throw? Or the frame that calls the
frame that calls throw?
Most of the authors of the x86_64 ELF ABI Processor Supplement read
this list. Perhaps one of them remembers something about this?
> In my example foo_personality() is set as personality routine for foo() so I
> assume the former is called with _Unwind_Context created for foo()
> I.e. foo()'s stack frame is 'current' and from this pov the value of
> 'previous frame' is unambiguous -- it's main()'s frame.
That is one plausible line of argument, certainly.
> BTW dwarf unwinding instructions generated by GCC use CFA-relative addresses
> to locate registers saved on stack frame:
Yes, and they work correctly.