This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/9 v7] Introduce target_{stop,continue}_ptid
- From: Pedro Alves <palves at redhat dot com>
- To: Gary Benson <gbenson at redhat dot com>, gdb-patches at sourceware dot org
- Cc: Doug Evans <dje at google dot com>
- Date: Fri, 12 Sep 2014 12:59:56 +0100
- Subject: Re: [PATCH 3/9 v7] Introduce target_{stop,continue}_ptid
- Authentication-results: sourceware.org; auth=none
- References: <1409320299-6812-1-git-send-email-gbenson at redhat dot com> <1409320299-6812-4-git-send-email-gbenson at redhat dot com>
On 08/29/2014 02:51 PM, Gary Benson wrote:
> +/* See target/target.h. */
> +
> +void
> +target_stop_ptid (ptid_t ptid)
> +{
> + struct target_waitstatus status;
> + int was_non_stop = non_stop;
> +
> + non_stop = 1;
> + target_stop (ptid);
> +
> + memset (&status, 0, sizeof (status));
> + target_wait (ptid, &status, 0);
> +
> + non_stop = was_non_stop;
> +}
One thing that was bugging me was that given that the names
of target_stop and target_stop_ptid are so similar and that
they have the same signature is ripe for confusion.
I just now noticed the elephant in the room -- target_stop is
asynchronous, doesn't wait for a stop, while and target_stop_ptid
is synchronous. Would you mind renaming this to target_stop_wait
or some such? And then add an explicit "and wait for it to stop"
or some such to the function's description.
Thanks,
Pedro Alves