Do not record a rejected target description
authorTom Tromey <tromey@adacore.com>
Fri, 6 Jan 2023 16:30:40 +0000 (09:30 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 15 Feb 2023 15:59:53 +0000 (08:59 -0700)
commit81b86eced24f905545b58aa6c27478104c364976
tree13ba0e3eb32d175df7304311bde05b496f2c86a9
parent71e28f788f4e5489501646093c6a34e01681d35b
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.
gdb/target-descriptions.c