Hi all,
Detaching on Cygwin often crashes the inferior, either
when gdb attaches to the inferior, or when gdb launches
the inferior as a child.
Initially I thought that somehow the FLAGS_TRACE_BIT
would be set in the context, and after detaching there would
be no debugger to catch the exception, but it turns out that
it isn't the case - I couldn't find a case where FLAGS_TRACE_BIT
was set. But, surprisingly doing a SetThreadContext with
CONTEXT_CONTROL makes the crashes go away - even if you don't
change the contents of the context. I'm not 100% sure why, but,
it fixes it. If MSFT sends me the Windows sources, I'll look
deeper :)