From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Andrew Burgess <andrew.burgess@embecosm.com>,
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 22:41:19 -0400 [thread overview]
Message-ID: <89b1b06a-b45c-c5e6-addd-cc6d37cd83a0@polymtl.ca> (raw)
In-Reply-To: <20210825161914.GH2581@embecosm.com>
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.
>> 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).
Simon
next prev parent reply other threads:[~2021-08-26 2:42 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 [this message]
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=89b1b06a-b45c-c5e6-addd-cc6d37cd83a0@polymtl.ca \
--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