public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Do not record a rejected target description
Date: Thu, 12 Jan 2023 12:33:56 -0700	[thread overview]
Message-ID: <20230112193356.1133696-1-tromey@adacore.com> (raw)

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


             reply	other threads:[~2023-01-12 19:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 19:33 Tom Tromey [this message]
2023-02-14 15:16 ` Tom Tromey
2023-02-14 15:48 ` Andrew Burgess
2023-02-14 17:27   ` Tom Tromey
2023-02-15 12:56     ` Andrew Burgess
2023-02-15 15:59       ` Tom Tromey
2023-02-15 21:19         ` Simon Marchi
2023-02-15 21:38           ` Tom Tromey
2023-02-16 19:20           ` Tom Tromey
2023-02-16 19:33             ` Simon Marchi
2023-02-17 10:19             ` Andrew Burgess
2023-02-17 14:09               ` Tom Tromey
2023-02-17 22:29                 ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230112193356.1133696-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).