This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 14/16] move async_client_callback and async_client_context into remote_state
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 24 Jun 2013 20:03:25 +0100
- Subject: Re: [PATCH 14/16] move async_client_callback and async_client_context into remote_state
- References: <1371835506-15691-1-git-send-email-tromey at redhat dot com> <1371835506-15691-15-git-send-email-tromey at redhat dot com> <51C88294 dot 9030604 at redhat dot com> <87fvw7uz6k dot fsf at fleche dot redhat dot com>
On 06/24/2013 07:43 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
>>> static void
>>> remote_async_serial_handler (struct serial *scb, void *context)
>>> {
>>> + struct remote_state *rs = context;
>
> Pedro> Does this actually work?
>
>>> + serial_async (rs->remote_desc, remote_async_serial_handler, rs);
>>> + rs->async_client_callback = callback;
>>> + rs->async_client_context = context;
>
> Pedro> Because I think CONTEXT is always NULL here.
>
> Pedro> And it'd seem a wrong to me to store the remote state in the
> Pedro> meant for context passed in by the target_async's caller?
>
> I think it should work.
>
> There are two callbacks and two "context" values here.
>
> In that second snippet, "callback" and "context" are the arguments to
> remote_async. We stash those in the struct remote_state.
>
> Then we call serial_async with remote_async_serial_handler as a callback
> and with the remote_state as the context.
>
> When remote_async_serial_handler is called, we fetch the original
> callback and the original context from the remote_state, and call those.
>
> We need this second callback layer because we want to add in the
> INF_REG_EVENT argument.
Ah, I see now. Sorry for missing it.
> I hope that's clear and correct.
Thanks, it is.
--
Pedro Alves