From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from jupiter.monnerat.net (jupiter.monnerat.net [46.226.111.226]) by sourceware.org (Postfix) with ESMTPS id 031203858C27 for ; Thu, 26 Aug 2021 10:53:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 031203858C27 Received: from patrick.monnerat ([192.168.0.128]) by jupiter.monnerat.net (8.14.8/8.14.8) with ESMTP id 17QAr8Zn010245 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Aug 2021 12:53:13 +0200 DKIM-Filter: OpenDKIM Filter v2.10.3 jupiter.monnerat.net 17QAr8Zn010245 Subject: Re: [PATCH] Replace deprecated_target_wait_hook by an observer To: Simon Marchi , Andrew Burgess Cc: gdb-patches@sourceware.org References: <20210822164256.144875-1-patrick@monnerat.net> <20210824161411.GE2581@embecosm.com> <3c65f6cf-0198-2efc-3db9-bbe8aafc58dc@monnerat.net> <20210825161914.GH2581@embecosm.com> <89b1b06a-b45c-c5e6-addd-cc6d37cd83a0@polymtl.ca> From: Patrick Monnerat Message-ID: <913e123e-104e-d79a-6a16-8b0110bd63a1@monnerat.net> Date: Thu, 26 Aug 2021 12:53:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <89b1b06a-b45c-c5e6-addd-cc6d37cd83a0@polymtl.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2021 10:53:39 -0000 On 8/26/21 4:41 AM, Simon Marchi wrote: > On 2021-08-25 12:19 p.m., Andrew Burgess wrote: >> * Patrick Monnerat [2021-08-25 15:30:28 +0200]: >> >>> On 8/24/21 6:14 PM, Andrew Burgess wrote: >>>> * Patrick Monnerat via Gdb-patches [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