[PATCH] Teach gdb how to unwind cygwin _sigbe frames

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Feb 24 23:04:00 GMT 2015

On Feb 24 15:28, Jon TURNEY wrote:
> 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.

Maybe the binutils folks can help?

> >>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.

Uh, good point.

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

You mean scanning the code and extracting the offset right from the
opcodes?  That's an... interesting... idea.  I would probably object to
it, but can't be bothered, considering Cygwin is doing the same with
ntdll.dll ;)


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150224/10a07db5/attachment.sig>

More information about the Cygwin mailing list