Re: [PATCH 02/18] Remote all-stop-on-top-of-non-stop

Pedro Alves
2015-11-23T18:39:13Z

On 11/23/2015 03:40 PM, Pedro Alves wrote:

> So I'm thinking that I should leave the original patch as is, and
> add some extra comments to remote_async. WDYT?

Like so:

diff --git i/gdb/remote.c w/gdb/remote.c
index 1618ea1..624f60d 100644
--- i/gdb/remote.c
+++ w/gdb/remote.c
@@ -13036,12 +13036,20 @@ remote_async (struct target_ops *ops, int enable)
event loop to process them. */
if (!QUEUE_is_empty (stop_reply_p, stop_reply_queue))
mark_async_event_handler (remote_async_inferior_event_token);
+ /* For simplicity, below we clear the pending events token
+ without remembering whether it is marked, so here we always
+ mark it. If there's actually no pending notification to
+ process, this ends up being a no-op (other than a spurious
+ event-loop wakeup). */
if (target_is_non_stop_p ())
mark_async_event_handler (rs->notif_state->get_pending_events_token);
}
else
{
serial_async (rs->remote_desc, NULL, NULL);
+ /* If the core is disabling async, it doesn't want to be
+ disturbed with target events. Clear all async event sources
+ too. */
clear_async_event_handler (remote_async_inferior_event_token);
if (target_is_non_stop_p ())
clear_async_event_handler (rs->notif_state->get_pending_events_token);

Thanks,
Pedro Alves