From: Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>,
Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Replace deprecated_target_wait_hook by an observer
Date: Thu, 26 Aug 2021 12:53:07 +0200 [thread overview]
Message-ID: <913e123e-104e-d79a-6a16-8b0110bd63a1@monnerat.net> (raw)
In-Reply-To: <89b1b06a-b45c-c5e6-addd-cc6d37cd83a0@polymtl.ca>
On 8/26/21 4:41 AM, Simon Marchi wrote:
> On 2021-08-25 12:19 p.m., Andrew Burgess wrote:
>> * 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).
> Oh, I have always seen it as the caller waiting for the target to
> produce some event (in a context where everything was blocking / not
> async... nowadays, with async, I always find using the term "wait" for
> "fetch an event" confusing). So the event would be
> "target_waited_on". Another way (it's not our current style so I
> wouldn't choose that) would be to name all events "on something". So
> "on_target_wait".
>
> Regardless, since we are debating this, I would suggest splitting the
> observer in two actuall:
>
> - target_pre_wait (or target_wait_pre or whatever)
> - target_post_wait (or target_wait_post or whatever)
>
> I think it's better to keep 1 observable == 1 event, rather than
> having two events in one with a boolean to differentiate.
If it is not a luxury to have 2 observers for such a function, I think
it's the best solution/naming.
>
>>> 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.
> I think that's ok, I don't think target_ops::wait implementations ever
> return null_ptid (although I haven't checked, it's just from memory).
>
An updated patch follows.
Patrick
prev parent reply other threads:[~2021-08-26 10:53 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
2021-08-26 2:41 ` Simon Marchi via Gdb-patches
2021-08-26 10:53 ` Patrick Monnerat via Gdb-patches [this message]
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=913e123e-104e-d79a-6a16-8b0110bd63a1@monnerat.net \
--to=gdb-patches@sourceware.org \
--cc=andrew.burgess@embecosm.com \
--cc=patrick@monnerat.net \
--cc=simon.marchi@polymtl.ca \
/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