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

Message ID 56535D4C.9030203@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Nov. 23, 2015, 6:39 p.m. UTC
  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:


Thanks,
Pedro Alves
  

Comments

Yao Qi Nov. 26, 2015, 3:52 p.m. UTC | #1
Pedro Alves <palves@redhat.com> writes:

> 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);

These comments are good to me.
  

Patch

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);