From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-4bf16baa865so253972627b3.13 for ; Thu, 12 Jan 2023 11:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QskoC+KGTHHOsSpyaT0lNClgUo2XjpaoiyEw0pjngUw=; b=iCTH/LhzUpXpq604k50ME2uQUiqRIrb4eidbE70pJsPuAd7rPlshZ5ZvOd3IKybbRF AojsE1RbYVSJQ5GJsz0hD1QtPFPDGWoVmuhy5hDTv2/WzXHbogLOjFyYCVdimnpOT8bi XBl0nit5JexjqNoOZaCUIYpfOrLIHmjcl+25NWia1SYVf0Djf66ts97qusvxuuH5pH9m ZabdgnFTkmLiInVAiEe1Xgo9FTpA7TvcKPpsNdkAZDvRdYxcC4PAbTXQgYdusrs9YL6r TDulmIbqPNn+ID/X3hF6Yvmxj+1fSxncEQr65a0AQxqSWJfG7XhFmRDTGxLT+VwtvWcK x9Ng== 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) From: Tom Tromey 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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. --- 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; -- 2.38.1