From patchwork Thu Nov 24 16:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61083 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 8910A382FAF2 for ; Thu, 24 Nov 2022 16:05:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8910A382FAF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669305928; bh=DUgdS+V0LfdagtTtmWGGGyqkrgQZjQNs8vZeXIiiKNo=; 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=s2QT3sgYKnkEtNThWvU0Vg72KGynL8eEMbM+rRbfvHmxKc+qi0Ndq8emnikYcajb0 lpc3S2RzJF+cFp+eylhyZRP40+Way4RN8Kd0IBVPOiOWTS0E/uMMLdWJBU0mXpAyVO mWL1JzGASBnn0QVXfeZvoqXFUx6bWj0kYK+pT31o= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 3109F3830B27 for ; Thu, 24 Nov 2022 16:04:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3109F3830B27 X-ASG-Debug-ID: 1669305869-0c856e02a0305f70001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id GaHpMS0aDTaq1oBF (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Thu, 24 Nov 2022 11:04:29 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id D3819441D65; Thu, 24 Nov 2022 11:04:29 -0500 (EST) X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 5/5] gdb: add inferior parameter to target_clear_description Date: Thu, 24 Nov 2022 11:04:28 -0500 X-ASG-Orig-Subj: [PATCH 5/5] gdb: add inferior parameter to target_clear_description Message-Id: <20221124160428.83804-6-simon.marchi@efficios.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221124160428.83804-1-simon.marchi@efficios.com> References: <20221124160428.83804-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1669305869 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 4165 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.102368 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3498.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, 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.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" From: Simon Marchi Make target_clear_description not dependent on the current inferior on entry. Add an inferior parameter, and make it switch the current inferior temporarily where needed. Mkae the callers pass the current inferior, no change in behavior is expected. Change-Id: I85e4c500fceee9fc037f209d188e608536ed3f13 --- gdb/infrun.c | 2 +- gdb/remote.c | 2 +- gdb/target-descriptions.c | 13 ++++++------- gdb/target-descriptions.h | 2 +- gdb/target.c | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index c678d5accce..02ca137f545 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1252,7 +1252,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target) this on "follow-exec-mode new", as the old inferior stays around (its description is later cleared/refetched on restart). */ - target_clear_description (); + target_clear_description (inf); target_follow_exec (inf, ptid, exec_file_target); } diff --git a/gdb/remote.c b/gdb/remote.c index ca6fd535a54..cf3b2c92d36 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4962,7 +4962,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p) if (remote_read_description_p (this) && gdbarch_target_desc (target_gdbarch ()) == NULL) { - target_clear_description (); + target_clear_description (current_inferior ()); target_find_description (current_inferior ()); } diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 40c04e0770f..1abe5c8ead6 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -588,13 +588,12 @@ target_find_description (inferior *inf) tdesc_info->fetched = true; } -/* Discard any description fetched from the current target, and switch - the current architecture to one with no target description. */ +/* See target-descriptions.h. */ void -target_clear_description (void) +target_clear_description (inferior *inf) { - target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); + target_desc_info *tdesc_info = get_tdesc_info (inf); if (!tdesc_info->fetched) return; @@ -603,7 +602,7 @@ target_clear_description (void) tdesc_info->tdesc = nullptr; gdbarch_info info; - if (!gdbarch_update_p (current_inferior (), info)) + if (!gdbarch_update_p (inf, info)) internal_error (_("Could not remove target-supplied description")); } @@ -1293,7 +1292,7 @@ set_tdesc_filename_cmd (const char *args, int from_tty, tdesc_info->filename = tdesc_filename_cmd_string; - target_clear_description (); + target_clear_description (current_inferior ()); target_find_description (current_inferior ()); } @@ -1320,7 +1319,7 @@ unset_tdesc_filename_cmd (const char *args, int from_tty) target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); tdesc_info->filename.clear (); - target_clear_description (); + target_clear_description (current_inferior ()); target_find_description (current_inferior ()); } diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h index ab534488d65..5f89e933b6d 100644 --- a/gdb/target-descriptions.h +++ b/gdb/target-descriptions.h @@ -40,7 +40,7 @@ void target_find_description (inferior *inf); inferior, and switch the current architecture to one with no target description. */ -void target_clear_description (void); +void target_clear_description (inferior *inf); /* Return the current inferior's target description. This should only be used by gdbarch initialization code; most access should be diff --git a/gdb/target.c b/gdb/target.c index 74925e139dc..bd3b6c98a57 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2484,7 +2484,7 @@ target_pre_inferior (int from_tty) invalidate_target_mem_regions (); - target_clear_description (); + target_clear_description (current_inferior ()); } /* attach_flag may be set if the previous process associated with