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: Doug Evans <dje at google dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Gary Benson <gbenson at redhat dot com>, gdb-patches at sourceware dot org
- Date: Fri, 12 Sep 2014 10:10:15 -0700
- 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> <5412E03C dot 1070402 at redhat dot com>
Pedro Alves writes:
> 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.
target_stop_and_wait would be a significantly more readable to me.
["stop_wait" makes me pause too long to figure out what was meant]
Or if a plain reading of "target_stop" implies waiting,
then rename target_stop to target_stop_no_wait or target_stop_async.
and use "target_stop" for "target stop and wait".
Do we want a convention for marking async vs sync routines?
e.g. append every async routine that is otherwise ambiguous with _async?
Or if gdb is becoming generally async, turn it around and
append _sync to every sync routine that is otherwise ambiguous.
[Or even allow both in certain instances.]
That way we'd no longer have to have individual discussions
whenever the topic comes up.