Hi guys, I'm going to apply the attached patch, which is a cleanup of the patch I posted here: http://sourceware.org/ml/gdb-patches/2008-10/msg00449.html This version, instead of overloading/abusing async_signal_handlers, comes up with a similar (although not quite the same) async_event_handlers concept. These async events are really very similar in implementation to async_signal_handlers, except that, signal handlers should keep the current behaviour of having high priority in relation to normal events (I changed that before), while async_event_handlers should compete in the same weight as the monitored file descriptors in the round-robin event source selection. Then, I'm going to use async_event_handlers instead of async_signal_handlers in gdb/remote.c for the extra target event sources in remote non-stop. (that's just s/async_signal/async_event/g on top of the remote.c hunk I had posted in the link above, I'll post an updated patch shortly.) -- Pedro Alves On Friday 17 October 2008 21:54:49, Pedro Alves wrote: > That being said, I took a step back, and relooked at the problems I was > having with async signals handlers, which is a mechanism to register a > callback function in the event-loop. Notice that the currently event > loop design is heavilly based on waitable file descriptors, with async > signal handlers being a secondary input event source. > > So I came up with the attached patch to adjust it to my needs. > > The biggest problem the attached patch solves is: > > - Since async signal handlers are always checked before polling the > file descriptors, I can easily starve the file descriptor based > sources. E.g., if I place several threads displace stepping a > breakpoint, forcing continuous remote traffic, the CLI becomes very, > very unresponsive, unusable really. This is because stdin itself > is registered as a monitored (via select/poll) file descriptor. > > To solve this, I adjusted the event loop to give equal priority to > all event-sources (timers, async signal handlers, monitored file > descriptors). The async signal handling was changed to instead > of immediatelly calling the associated callback, it installs an > event in the "ready" queue, just like the file-descriptor and > timer based sources. I then make sure that I poll each of the > possible event sources once (select/poll with timeout 0 too). If > if no event is found ready, then, we go blocking waiting for one > in select/poll. > > I can sucessfully debug a non-stop linux gdbserver from both > a linux host and a Windows (mingw32) host with this. > > The remote.c changes below apply on top of the non-stop support > patch I sent yesterday, and it's what I used to test, shown here > so you could see what was required that change, in case you're > curious about it.