From patchwork Fri Feb 3 14:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 64260 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F41043858C60 for ; Fri, 3 Feb 2023 14:31:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F41043858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675434675; bh=3kvUOrSqPdOn4ddVonAvQBiy8kwlNiTnYdNnw0in4qY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=vgSzxc1tOibSTcPY5Q/FRpN4obdz3omoI8vN9lAIVyGBfMD/voUZwxSN7gYWaLlMv A1KmJXRC/3jjtIlMvmRIaa6l/M6DZwc3MtcsuOJjbEs/3aQWyHxSjXcX5Qw3gUHDwB DVptrOVWlZCRzoS8J4aBVU3uZRxTmQHwgass/lnE= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id C8BE03858C52 for ; Fri, 3 Feb 2023 14:30:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8BE03858C52 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 313EUJ2Z026681 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 3 Feb 2023 09:30:23 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 313EUJ2Z026681 Received: from simark.localdomain (unknown [217.28.27.60]) (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 ESMTPSA id 506BC1E222; Fri, 3 Feb 2023 09:21:29 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 5/5] gdb: make target_desc_info_from_user_p a method of target_desc_info Date: Fri, 3 Feb 2023 09:21:26 -0500 Message-Id: <20230203142126.286866-6-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203142126.286866-1-simon.marchi@polymtl.ca> References: <20230203142126.286866-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 3 Feb 2023 14:30:19 +0000 X-Spam-Status: No, score=-3189.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Move the implementation over to target_desc_info. Remove the target_desc_info forward declaration in target-descriptions.h, it's no longer needed. Change-Id: Ic95060341685afe0b73af591ca6efe32f5e7e892 --- gdb/inferior.c | 2 +- gdb/inferior.h | 5 +++++ gdb/target-descriptions.c | 8 -------- gdb/target-descriptions.h | 8 -------- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/gdb/inferior.c b/gdb/inferior.c index 65863440b9c0..a1e3c79d8a20 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -961,7 +961,7 @@ clone_inferior_command (const char *args, int from_tty) /* If the original inferior had a user specified target description, make the clone use it too. */ - if (target_desc_info_from_user_p (&inf->tdesc_info)) + if (inf->tdesc_info.from_user_p ()) inf->tdesc_info = orginf->tdesc_info; clone_program_space (pspace, orginf->pspace); diff --git a/gdb/inferior.h b/gdb/inferior.h index d902881bfe24..bac483f0f78d 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -345,6 +345,11 @@ extern void switch_to_inferior_no_thread (inferior *inf); struct target_desc_info { + /* Returns true if INFO indicates the target description had been supplied by + the user. */ + bool from_user_p () + { return !this->filename.empty (); } + /* A flag indicating that a description has already been fetched from the target, so it should not be queried again. */ bool fetched = false; diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 6defd5bbe863..b08a185dfa21 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -451,14 +451,6 @@ get_arch_data (struct gdbarch *gdbarch) return result; } -/* See target-descriptions.h. */ - -int -target_desc_info_from_user_p (struct target_desc_info *info) -{ - return info != nullptr && !info->filename.empty (); -} - /* The string manipulated by the "set tdesc filename ..." command. */ static std::string tdesc_filename_cmd_string; diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h index b835e144c680..ee48fdfaa0c2 100644 --- a/gdb/target-descriptions.h +++ b/gdb/target-descriptions.h @@ -26,9 +26,6 @@ struct tdesc_arch_data; struct target_ops; -/* An inferior's target description info is stored in this opaque - object. There's one such object per inferior. */ -struct target_desc_info; struct inferior; /* Fetch the current inferior's description, and switch its current @@ -48,11 +45,6 @@ void target_clear_description (void); const struct target_desc *target_current_description (void); -/* Returns true if INFO indicates the target description had been - supplied by the user. */ - -int target_desc_info_from_user_p (struct target_desc_info *info); - /* Record architecture-specific functions to call for pseudo-register support. If tdesc_use_registers is called and gdbarch_num_pseudo_regs is greater than zero, then these should be called as well.