[PATCH 2/4] gdb: make remote target clear its async event handler in wait
Simon Marchi
simon.marchi@polymtl.ca
Thu Feb 4 18:34:04 GMT 2021
On 2021-02-04 1:00 p.m., Pedro Alves wrote:
> On 30/11/20 16:52, Simon Marchi via Gdb-patches wrote:
>
>> However, the code in remote_async_inferior_event_handler checks for for
>
> s/for for/for/
>
>> pending events in addition to whether the stop reply queue is empty, so
>> I've made remote_target::wait check for that as well. I'm not
>> completely sure this is ok, since I don't understand very well yet how
>> the pending events mechanism works. But I figured it was safer to do
>> this in order to avoid missing events, worst case it just leads to
>> unnecessary calls to remote_target::wait.
>
> It won't hurt, but I think it shouldn't be necessary -- if putpkt_binary or
> getpkt_or_notif_sane_1 see a notification (search for '%'), we end up in
> handle_notification, which marks state->get_pending_events_token, which
> then leads us to:
>
> -> remote_async_get_pending_events_handler
> -> remote_notif_get_pending_events
> -> remote_notif_stop_ack
> -> remote_target::push_stop_reply
> -> mark_async_event_handler (rs->remote_async_inferior_event_token);
>
> which then ends up in target_target::wait.
>
> I don't recall exactly why I had to put the check for the pending
> event in remote_async_inferior_event_handler, though. Maybe it was
> necessary because events auto-cleared back then.
Ok, I'll push this patch it as-is then, but look into simplifying the code
as another patch.
> Anyhow, this LGTM. Patches #3 and #4 LGTM too.
Thanks, will push.
Simon
More information about the Gdb-patches
mailing list