From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Patrick Monnerat <patrick@monnerat.net>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Replace deprecated_target_wait_hook by an observer
Date: Wed, 25 Aug 2021 17:19:14 +0100 [thread overview]
Message-ID: <20210825161914.GH2581@embecosm.com> (raw)
In-Reply-To: <3c65f6cf-0198-2efc-3db9-bbe8aafc58dc@monnerat.net>
* Patrick Monnerat <patrick@monnerat.net> [2021-08-25 15:30:28 +0200]:
>
> On 8/24/21 6:14 PM, Andrew Burgess wrote:
> > * Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org> [2021-08-22 18:42:56 +0200]:
> >
> > > +DEFINE_OBSERVABLE (waiting_for_target);
> > Given we already have events 'target_changed' and 'target_resumed', I
> > wonder if it would be more consistent to name this event 'target_wait'?
> >
> Yes, it's possible. Here are the two reasons why I did not name this
> observer 'target_wait':
>
> 1) Because the observer is not supposed to wait by itself, I fear it will be
> a source of confusion.
>
> 2) As a good old C programmer, I still have some reluctance naming an object
> as a global procedure. Not being declared in the same namespace though!
>
> Comments are welcome!
How about 'target_waiting' then? This seems more inline with the
existing naming, seems to indicate that the target _is_ waiting, not
the that observer _should_ wait (so avoiding #1), and is a new name
(so avoiding #2).
>
> > > - return target->wait (ptid, status, options);
> > > + gdb::observers::waiting_for_target.notify (true, ptid);
> > > + event_ptid = target->wait (ptid, status, options);
> > > + gdb::observers::waiting_for_target.notify (false, event_ptid);
> > > + return event_ptid;
> > I would be tempted to wrap this notification inside an RAII class,
> > then we will be guaranteed to send the second notification, even in
> > the event that the wait call exits via an exception.
>
> That would make sense, but in case we have an exception, event_ptid is not
> known. How would you handle it? pass it as null_ptid?
Yeah I guess that would make sense.
Thanks,
Andrew
>
> Thanks for review,
>
> Patrick
>
next prev parent reply other threads:[~2021-08-25 16:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-22 16:42 Patrick Monnerat via Gdb-patches
2021-08-23 16:26 ` Simon Marchi via Gdb-patches
2021-08-23 17:36 ` Patrick Monnerat via Gdb-patches
2021-08-23 17:48 ` Simon Marchi via Gdb-patches
2021-08-23 18:01 ` Patrick Monnerat via Gdb-patches
2021-08-24 16:14 ` Andrew Burgess
2021-08-25 13:30 ` Patrick Monnerat via Gdb-patches
2021-08-25 16:19 ` Andrew Burgess [this message]
2021-08-26 2:41 ` Simon Marchi via Gdb-patches
2021-08-26 10:53 ` Patrick Monnerat via Gdb-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210825161914.GH2581@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=patrick@monnerat.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox