deadlock on console mutex in gdb

Takashi Yano
Thu Jan 13 10:56:46 GMT 2022

Sorry for being absent for a long time.

On Thu, 23 Dec 2021 11:32:51 -0400
David McFarland wrote:
> Takashi Yano <> writes:
> > I think there is no other way than not to wait mutex in the
> > debugger process. If anyone have any other idea, please let
> > me know.
> I have a few thoughts:
> I believe gdb currently just uses windows debugging APIs, so it doesn't
> treat cygwin as an operating system. On other operating systems there
> would be some mechanism to prevent kernel mutexes from deadlocking. It
> obviously can't just wait for all syscalls to complete, but it must
> avoid blocking kernel tasks that hold mutexes. Perhaps we could do
> something similar on cygwin, but it would probably mean providing
> cygwin-specific debugging APIs and support in gdb. I'd have to do some
> more research into how this works on e.g. Linux.
> Can we avoid using inter-process mutexes for this? What would you expect
> to break if we just used a per-process mutex?

I think we need inter-process mutex. Otherwise, write() calls
from multiple process will not be done in atomic.

> If we do need an inter-process mutex, perhaps we could have a daemon
> process responsible for it? I think that would be a bit of a departure
> for cygwin.

I cannot imagine how to implement this...

Takashi Yano <>

More information about the Cygwin-developers mailing list