[PATCH] Teach gdb how to unwind cygwin _sigbe frames

Jon TURNEY jon.turney@dronecode.org.uk
Tue Feb 24 21:14:00 GMT 2015

On 23/02/2015 21:24, Corinna Vinschen wrote:
> On Feb 23 18:15, Jon TURNEY wrote:
>> I really wanted to do this by adding some DWARF CFI to the generated sigfe.s
>> file, but there doesn't seem to currently be a way to correctly describe
>> _sigbe's frame using that.
> I was wondering about this already.  It seems weird if the CFI stuff
> doesn't allow for a situation like that

My understanding is limited, but it seems to me that it only describes 
register unwinding, not unwinding the state of an arbitrary memory location.

After writing my patch, which only unwinds one sigstack entry correctly, 
I went back and had another go at writing the equivalent CFI, which I 
think should be possible, but I still couldn't get it to work.

I'll take another look.

>> So instead, write a custom unwinder for _sigbe frames, which gets the return
>> address from the sigstack.
>> Implemented for i386 and amd64.
> Cool.  Really.  But, shouldn't that go to the gdb-patches mailing list?
>> 4. This unfortunately ends up hardcoding into gdb the offset of sigstackptr in
>> the cygwin TLS area from the top of stack, and so will break if that changes.
>> Hopefully that doesn't happen to often.
> It happens too often to be ignored.  Wouldn't it make sense to add
> a cygwin_internal call to return tls offsets or addresses, the later
> if the argument is a pointer to the stack or cygtls area?

That's not going to give the right answer when remote debugging.

But the offset is, of course, encoded into the _sigbe routine, so the 
better approach is probably to extract it from there.

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list