From patchwork Thu Jan 12 19:33:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 63120 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 0CAC03857835 for ; Thu, 12 Jan 2023 19:34:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CAC03857835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673552068; bh=QskoC+KGTHHOsSpyaT0lNClgUo2XjpaoiyEw0pjngUw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=rNZIwHVLTOqDKyP5GhQyER6g9+Gacj8L3QQYQ62KmAW7e5G/hlsbsgm+Grsj3zhGz 6UCuXdyQLElLy4MeVWyirAlv7cQnm3BkbLdMyJPtc2J45cWTbrA+Y3f0gkZg+BJNiM ipIrKBgtvvStpavW45PYPMbw1Hj+2GL58uPd+J2k= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by sourceware.org (Postfix) with ESMTPS id DB4DF3858C66 for ; Thu, 12 Jan 2023 19:34:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB4DF3858C66 Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-4bf16baa865so253972627b3.13 for ; Thu, 12 Jan 2023 11:34:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QskoC+KGTHHOsSpyaT0lNClgUo2XjpaoiyEw0pjngUw=; b=DUP8JsoMA1u3MbFbakZdH8ucEw2Mee+bdfD9vxMDtU1nCgKZFZhHQbiF4NbWfqja15 dU9RtHT+l1Az7c77b/EHjTz61tGMMze1Ii1jW1r07PeTsaFyRF+g4WcI2QHsgiJ+XOmz oYiDxF16r/6oq0K9bKKibYjPg160CBpFt9B1Eb1YQY8GUhPZuBHe64BIODGjnezLtG2Y Gg40n9XgdwvBIIKtEEmn9aaWdf9SnkOhctvMIXOe7FcCTCg3wJFN0qw8x+WPyTUsAoP8 kuOe5dY0WKzxRagCSLxvkAsxVmbOpYStK6sycXSpE7dT1j0Efwddao/pUX0gaOV4odJq pgqQ== X-Gm-Message-State: AFqh2krJcaDCDfKoUIPHdRbLObKZVBXsDnP+0+vBka19pdQRPHCaXNmS wWvU9BEtTToZ4E7obnL9N6XrRkOodZATg5U3 X-Google-Smtp-Source: AMrXdXt/A/EQcLfOw1ZeflvbQrlHK4FX6ulMLsespsQQWd2fnrtjdxMMUoDexkeYvzrZFedxuEab4w== X-Received: by 2002:a81:4e16:0:b0:3cb:1f49:4a59 with SMTP id c22-20020a814e16000000b003cb1f494a59mr26521164ywb.44.1673552044323; Thu, 12 Jan 2023 11:34:04 -0800 (PST) Received: from localhost.localdomain (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id h10-20020a05620a284a00b006feea093006sm11362691qkp.124.2023.01.12.11.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 11:34:03 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Do not record a rejected target description Date: Thu, 12 Jan 2023 12:33:56 -0700 Message-Id: <20230112193356.1133696-1-tromey@adacore.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When connecting to a certain target, gdb issues a warning about the target description: (gdb) target remote localhost:7947 Remote debugging using localhost:7947 warning: Architecture rejected target-supplied description If you then kill the inferior and change the exec-file, this will happen: (gdb) file bar Architecture of file not recognized. After this, debugging doesn't work very well. What happens here is that, despite the warning, target_find_description records the downloaded description in the target_desc_info. Then the "file" command ends up calling set_gdbarch_from_file, which uses that description. It seems to me that, because the architecture rejected the description, it should not be used. That is what this patch implements. Tested-By: Simon Marchi --- gdb/target-descriptions.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 1a451c79b82..38d0b3f8c7d 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -565,7 +565,10 @@ target_find_description (void) info.target_desc = tdesc_info->tdesc; if (!gdbarch_update_p (info)) - warning (_("Architecture rejected target-supplied description")); + { + warning (_("Architecture rejected target-supplied description")); + tdesc_info->tdesc = nullptr; + } else { struct tdesc_arch_data *data;