public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>,
	Luis Machado <luis.machado@arm.com>,
	gdb-patches@sourceware.org
Cc: thiago.bauermann@linaro.org
Subject: Re: [PATCH v7 15/18] [gdb/generic] corefile/bug: Add hook to control the use of target description notes from corefiles
Date: Wed, 27 Sep 2023 18:44:33 +0100	[thread overview]
Message-ID: <87il7vwlxa.fsf@redhat.com> (raw)
In-Reply-To: <082c6cbd-7a30-4b21-962a-3c87f4da9aa8@polymtl.ca>

Simon Marchi <simon.marchi@polymtl.ca> writes:

> On 9/21/23 06:44, Luis Machado via Gdb-patches wrote:
>>>>> For point (2) I agree with the premise that we need a mechanism to stop
>>>>> AArch64 loading the incorrect single NT_GDB_TDESC.  This is a slight
>>>>> change in stance from what I originally wrote, but our IRC conversation
>>>>> showed me I was wrong originally.  I don't have time this evening to
>>>>> look at this, but will follow up again tomorrow with more thoughts.
>>>
>>> I wonder, instead of adding the new hook, maybe we should just reorder
>>> the checks in core_target::read_description -- ask the gdbarch to grok a
>>> tdesc from the .regs (etc) sections, and if that fails, check for an
>>> encoded tdesc.
>>>
>> 
>> That's exactly what I did a few versions earlier. But Simon pointed out it would
>> effectively be a conflicting situation given our choice of defaulting to reading the
>> target description from the NT_GDB_TDESC. So I went with the hook, which, to be honest,
>> seems cleaner.
>
> Hi,
>
> I did not have the complete historical picture when I suggested this,
> Andrew later explained that this was added for some RISC-V target for
> which a tdesc could not be reconstructed from just the dumped register
> state.  I thought that the NT_GDB_TDESC note was a better source of
> truth than just the register state.  My understanding now is that for
> most targets (including AArch64 with SME and friends), reconstructing
> the tdesc from the register state works equally well as reading an
> NT_GDB_TDESC note (that holds the right tdesc).  So, we can say that
> having the NT_GDB_TDESC note there is useless in these cases.
>
> So now, my question is: when we generate a core, should we only generate
> an NT_GDB_TDESC note for those targets for which we know a tdesc note
> will be necessary?  That would involve a gdbarch hook where the arch can
> say "yes please generate a tdesc note in this core", which would default
> to false.

I would not oppose such a change, but the problem here really was that
GDB was just writing out the wrong thing -- the generic, incorrect,
global tdesc, rather than the correct thread specific tdesc.

But you are correct, for hosted environments (Linux, FreeBSD), where the
OS can create a core file without a NT_GDB_TDESC, we really do need to
be able to figure out the architecture just from the core file contents,
so dropping the NT_GDB_TDESC for these cases really shouldn't be a
problem.

Thanks,
Andrew


  reply	other threads:[~2023-09-27 17:44 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 21:26 [PATCH v7 00/18] SME support for AArch64 gdb/gdbserver on Linux Luis Machado
2023-09-18 21:26 ` [PATCH v7 01/18] [gdb/aarch64] Fix register fetch/store order for native AArch64 Linux Luis Machado
2023-09-18 21:26 ` [PATCH v7 02/18] [gdb/aarch64] refactor: Rename SVE-specific files Luis Machado
2023-09-18 21:26 ` [PATCH v7 03/18] [gdb/gdbserver] refactor: Simplify SVE interface to read/write registers Luis Machado
2023-09-18 21:26 ` [PATCH v7 04/18] [gdb/aarch64] sve: Fix return command when using V registers in a SVE-enabled target Luis Machado
2023-09-18 21:26 ` [PATCH v7 05/18] [gdb/aarch64] sme: Enable SME registers and pseudo-registers Luis Machado
2023-10-13 13:06   ` Tom Tromey
2023-10-13 14:44     ` Luis Machado
2023-10-13 14:50       ` Luis Machado
2023-09-18 21:26 ` [PATCH v7 06/18] [gdbserver/generic] Convert tdesc's expedite_regs to a string vector Luis Machado
2023-09-18 21:26 ` [PATCH v7 07/18] [gdbserver/aarch64] refactor: Adjust expedited registers dynamically Luis Machado
2023-09-18 21:26 ` [PATCH v7 08/18] [gdbserver/aarch64] sme: Add support for SME Luis Machado
2023-09-18 21:26 ` [PATCH v7 09/18] [gdb/aarch64] sve: Fix signal frame z/v register restore Luis Machado
2023-09-18 21:26 ` [PATCH v7 10/18] [gdb/aarch64] sme: Signal frame support Luis Machado
2023-09-18 21:26 ` [PATCH v7 11/18] [gdb/aarch64] sme: Fixup sigframe gdbarch when vg/svg changes Luis Machado
2023-09-18 21:26 ` [PATCH v7 12/18] [gdb/aarch64] sme: Support TPIDR2 signal frame context Luis Machado
2023-09-18 21:26 ` [PATCH v7 13/18] [gdb/generic] Get rid of linux-core-thread-data Luis Machado
2023-09-18 21:26 ` [PATCH v7 14/18] [gdb/generic] corefile/bug: Use thread-specific gdbarch when dumping register state to core files Luis Machado
2023-09-18 21:26 ` [PATCH v7 15/18] [gdb/generic] corefile/bug: Add hook to control the use of target description notes from corefiles Luis Machado
2023-09-19 20:49   ` Simon Marchi
2023-09-20  5:49     ` Luis Machado
2023-09-20 14:01       ` Luis Machado
2023-09-20 14:22   ` Andrew Burgess
2023-09-20 15:26     ` Andrew Burgess
2023-09-20 23:35       ` Luis Machado
2023-09-21 10:02         ` Andrew Burgess
2023-09-21 10:44           ` Luis Machado
2023-09-25  9:57             ` Andrew Burgess
2023-09-26 12:39               ` Luis Machado
2023-09-27 17:56                 ` Andrew Burgess
2023-09-28  8:23                   ` Luis Machado
2023-10-03 17:23                     ` Andrew Burgess
2023-10-04 15:27                       ` Luis Machado
2023-09-25 15:41             ` Simon Marchi
2023-09-27 17:44               ` Andrew Burgess [this message]
2023-09-18 21:26 ` [PATCH v7 16/18] [gdb/aarch64] sme: Core file support for Linux Luis Machado
2023-09-18 21:26 ` [PATCH v7 17/18] [gdb/testsuite] sme: Add SVE/SME testcases Luis Machado
2023-09-19 19:12   ` Simon Marchi
2023-09-19 20:02     ` Luis Machado
2023-09-18 21:26 ` [PATCH v7 18/18] [gdb/docs] sme: Document SME registers and features Luis Machado
2023-10-04 15:27 ` [PATCH v7 00/18] SME support for AArch64 gdb/gdbserver on Linux Luis Machado

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=87il7vwlxa.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.com \
    --cc=simon.marchi@polymtl.ca \
    --cc=thiago.bauermann@linaro.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).