From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gLURJ9tvBGUStRYAWB0awg (envelope-from ) for ; Fri, 15 Sep 2023 10:53:15 -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=t5VIoZ/V; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9D96A1E0C3; Fri, 15 Sep 2023 10:53:15 -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 8D8F91E0C2 for ; Fri, 15 Sep 2023 10:53:13 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F11D385697D for ; Fri, 15 Sep 2023 14:53:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F11D385697D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694789593; bh=aTFtyoXeq5uGF+IBX7+OXHDKDY9fqFnm4f4ekSCMCvc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=t5VIoZ/VKyOpUumdIFs5lEz7GPa36ZhIF/pwQuZDiLxJUx3A8yzuXXu+wDUAYclQ0 KiZiah1IQKP/HuFfbAjoJF0oMA1gx8q50fTUBAEPRJpCZIfIBG0JE56Kn1nqHUOMXd kARZKJ/nD8ETD9Ju3JHbMUwRongcEbQ1uW01UpH4= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 1796F3858D1E for ; Fri, 15 Sep 2023 14:52:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1796F3858D1E 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 55E951E028; Fri, 15 Sep 2023 10:52:51 -0400 (EDT) To: gdb-patches@sourceware.org Cc: Simon Marchi , Tom Tromey Subject: [PATCH v3 1/3] gdb: add inferior_cloned observable Date: Fri, 15 Sep 2023 10:52:11 -0400 Message-ID: <20230915145249.22318-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 Approved-By: Tom Tromey --- 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