From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KB8ADkjVAWUjixUAWB0awg (envelope-from ) for ; Wed, 13 Sep 2023 11:29:12 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=uI6rtCbb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 358831E0C3; Wed, 13 Sep 2023 11:29:12 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2727B1E028 for ; Wed, 13 Sep 2023 11:29:10 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D00AA385782B for ; Wed, 13 Sep 2023 15:29:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D00AA385782B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694618949; bh=EPM3Q2K8KA+O9UkfWsiMtLxFfWQJnmazYnQbtdsAJgk=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=uI6rtCbb+HHu4l8WYzXAe0tO8S/vsIr2PMbs+pbHE5q0Oz8eN1xWqOcu63qaOULau x38/2jGnMc07yQHspJ4oT52KPvmsmaxlzI59PRrGoXJBWo07YR/IQVCUgfR0hCqUFe gwPNCXccdiDlSRpbk/ByZbHFlkhznseNFxNk0H+Y= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 270C13858D39 for ; Wed, 13 Sep 2023 15:28:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 270C13858D39 Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 3F3DB1E028; Wed, 13 Sep 2023 11:28:46 -0400 (EDT) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/2] gdb: add inferior_cloned observable Date: Wed, 13 Sep 2023 11:28:37 -0400 Message-ID: <20230913152845.1540064-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3497.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" The following patch makes the amdgpu port transfer a property from the original inferior to the new inferior when using the clone-inferior command. Add the inferior_cloned observable to help with this. Change-Id: Id845a799813ec49b1b7b2fcb97b07d0a1e5e2631 --- gdb/inferior.c | 2 ++ gdb/observable.c | 1 + gdb/observable.h | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/gdb/inferior.c b/gdb/inferior.c index ce4960a508aa..550bbd2827c0 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -1041,6 +1041,8 @@ clone_inferior_command (const char *args, int from_tty) for (const std::string &unset_var : orginf->environment.user_unset_env ()) inf->environment.unset (unset_var.c_str ()); + + gdb::observers::inferior_cloned.notify (orginf, inf); } } diff --git a/gdb/observable.c b/gdb/observable.c index a18b863fb471..33e51223cf41 100644 --- a/gdb/observable.c +++ b/gdb/observable.c @@ -58,6 +58,7 @@ DEFINE_OBSERVABLE (inferior_appeared); DEFINE_OBSERVABLE (inferior_pre_detach); DEFINE_OBSERVABLE (inferior_exit); DEFINE_OBSERVABLE (inferior_removed); +DEFINE_OBSERVABLE (inferior_cloned); DEFINE_OBSERVABLE (memory_changed); DEFINE_OBSERVABLE (before_prompt); DEFINE_OBSERVABLE (gdb_datadir_changed); diff --git a/gdb/observable.h b/gdb/observable.h index c0bafc51f143..4ea203c6fc38 100644 --- a/gdb/observable.h +++ b/gdb/observable.h @@ -172,6 +172,10 @@ extern observable inferior_exit; This method is called immediately before freeing INF. */ extern observable inferior_removed; +/* The inferior CLONE has been created by cloning INF. */ +extern observable + inferior_cloned; + /* Bytes from DATA to DATA + LEN have been written to the inferior at ADDR. */ extern observable