From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vgayOJptJmF9BQAAWB0awg (envelope-from ) for ; Wed, 25 Aug 2021 12:19:38 -0400 Received: by simark.ca (Postfix, from userid 112) id D7F9F1EE1A; Wed, 25 Aug 2021 12:19:38 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1189C1EDF0 for ; Wed, 25 Aug 2021 12:19:38 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7DFEA385AC1E for ; Wed, 25 Aug 2021 16:19:37 +0000 (GMT) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 3B7EA3857829 for ; Wed, 25 Aug 2021 16:19:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3B7EA3857829 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x32d.google.com with SMTP id 79-20020a1c0452000000b002e6cf79e572so4715348wme.1 for ; Wed, 25 Aug 2021 09:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=d0uho+K8h8QqR9AMVxNBSJDq6h2WszaaP9Pwl4vRDxs=; b=XqQQ1wSmJVL+OKP+xfxn5xfoO2/3Q+fbCh+oyRwy0GcwzY2GO7wj5BWgN7lADYc4kR lSLR/ymJCK0HJcJdMj7EXmtF4Ls0a/RtQeQZs0UlcahD570Dxcy72a1FpI5EVOr8copo TNzVALefUuW6iLb9Qd+FPO4naUq1JTVbkml+PfijGcmG6pUtm0l+MHA5x4qFpJiTyP/v pFUSi4TkcS2IF4yAynTS5SH2zlgBdQ3afd9YzYqcadx0DO4rK7da0Hfsg86p/uLrtTb5 3eeq++3Zykl8OIh/DD5Yzo+WN8KruF+L6J8YdR2UXKIDanafRt9Pwp839sWXMsAEIDSK ovVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=d0uho+K8h8QqR9AMVxNBSJDq6h2WszaaP9Pwl4vRDxs=; b=q76ohmtuHeJtZm1y3MrOjPMmhShUU8/h+TqLI6UQFxk4It+VgM7HXw9Bz/coARAXKW 1xFvEKrTNGAwt+PSlvfS3s+SLIWRS0HDPHqYoVL3bGvDn/OvDxTYuzYM+flyWX3PpiJr Xh2hf+cbo0RmFUcVaRdbqLHNadVVA3Rxtyg8e8EuRxQZIs7XJrzP/swoyK/XmBnouGum Ael6W/fXYK2HNPgZgTgCU523o7Daby1jc3XuW9Gl2Ks7sgepmk7H75dxUPknClKsVX+2 vFgYStWdtoemY9aKaUov3kJQ1rSdT1u80OzOL79hyAhnIKJpzWuNIBZDIDnWEeap94iE 3rbQ== X-Gm-Message-State: AOAM533jm1CpX4/YLV/WtYlV0Z2BmpVeEimRrmsyM7f0PfcMa6plBw/C 2dv+wl15l91IMboQb8BRLak+njLJ9WgkmQ== X-Google-Smtp-Source: ABdhPJy8ixI+tXSX2xZmmQTL+jr7ngljwC6fwGcPuRgsmM765JZA/l+XgUPUkDF/Y7ob4az/4Fky3w== X-Received: by 2002:a1c:4407:: with SMTP id r7mr10448454wma.150.1629908356347; Wed, 25 Aug 2021 09:19:16 -0700 (PDT) Received: from localhost (host86-188-49-44.range86-188.btcentralplus.com. [86.188.49.44]) by smtp.gmail.com with ESMTPSA id s17sm5943000wmj.12.2021.08.25.09.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 09:19:15 -0700 (PDT) Date: Wed, 25 Aug 2021 17:19:14 +0100 From: Andrew Burgess To: Patrick Monnerat Subject: Re: [PATCH] Replace deprecated_target_wait_hook by an observer Message-ID: <20210825161914.GH2581@embecosm.com> References: <20210822164256.144875-1-patrick@monnerat.net> <20210824161411.GE2581@embecosm.com> <3c65f6cf-0198-2efc-3db9-bbe8aafc58dc@monnerat.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3c65f6cf-0198-2efc-3db9-bbe8aafc58dc@monnerat.net> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 17:17:07 up 8 days, 5:13, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] 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: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" * 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). > > > > - 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 >