public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Do not record a rejected target description
@ 2023-02-15 16:06 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-02-15 16:06 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=81b86eced24f905545b58aa6c27478104c364976

commit 81b86eced24f905545b58aa6c27478104c364976
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri Jan 6 09:30:40 2023 -0700

    Do not record a rejected target description
    
    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.

Diff:
---
 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 b08a185dfa2..c62d4368d6b 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -500,7 +500,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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-15 16:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 16:06 [binutils-gdb] Do not record a rejected target description Tom Tromey

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).