public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Luis Machado <luis.machado@arm.com>,
	John Baldwin <jhb@FreeBSD.org>,
	gdb-patches@sourceware.org,
	David Spickett <David.Spickett@arm.com>
Subject: Re: [PATCH] [Arm] Remove dead FPA code
Date: Thu, 13 Oct 2022 09:29:38 +0100	[thread overview]
Message-ID: <42083a0b-9723-8bde-470a-247fbb0740eb@palves.net> (raw)
In-Reply-To: <df01dddb-7158-6fee-f5e2-5f43b2b635bd@arm.com>



On 2022-10-13 8:23 a.m., Luis Machado wrote:
> On 10/10/22 15:58, Pedro Alves wrote:
>> On 2022-10-05 9:26 a.m., Luis Machado wrote:
>>
>>> Yeah, that's what I was worried about. Register discoveries without XML are not great, and more recently debugging stubs have been
>>> exposing more system registers. Having to consider FPA (which was *removed* 10 years ago from GCC, but fell in disuse before then) is not
>>> acceptable at this point.
>>>
>>> If those debugging stubs want to skip XML, I think it would be reasonable for them to at least update the expected 'g' packet to contain just
>>> the basic registers, with CPSR as 16.
>>>
>>> That might need some coordination. I can coordinate this from the Linux Kernel's side, but I never dealt with the BSD kernels.
>>
>> I'm not seeing much point in this:
>>
>> #1 - If the remote side supplies XML, then the register number doesn't really matter, GDB auto-maps the numbers.
>>
>> #2 - If the remote side doesn't supply XML, then you're just setting up for a world of coordination pain for no benefit.
>>
>> In GDB, to keep things working, we just have to keep the FPA register number hole in place.  That's hardly causing
>> any maintenance burden, IMO.  We just have to have comments in place explaining why we have them.
> 
> Based on a recent thread with the Arm Linux Kernel maintainer, he finds it reasonable to make kgdb
> return XML data and to keep a compatibility layer (the g guesses) going for a reasonable amount of
> time, after which we can retire the guesses and drop the code.

Good.  Of course, the Linux kernel isn't going to be the only remote server or stub out there.

> 
> It is not clear when we'll drop the compatibility layer, but at least we can get some traction towards
> making targets use XML and maybe add some deprecation warning to the g packet guesses. If we keep the code as-is,
> there is no incentive to update targets using old mechanisms.

Deprecation warnings makes sense to me.  Much more user-friendly than flat out removing the guesses without a warning
period, and/or changing the non-XML g/G packet layout.

The (unwritten) policy for as long as I'm worked on GDB has always been that you don't change the hardcoded g/G packet
layout, ever.  You can only grow it.  Or use XML.  

While we can push new versions of tools to switch to XML, the older versions will still be out there.  Stubs can
be embedded in devices that aren't going to update easily or at all.  Is it a good idea to to cause them pain?  IMHO, no.

Note, for the FPA removal, you should send an email to gdb@ as well, see here for the obsoleting procedure:

  https://sourceware.org/gdb/wiki/Internals%20Obsoleting-code

> 
> GDB talks about FPA as if it were something that existed not long ago, while in fact it was deprecated even before GDB
> started using XML descriptions. But the registers were kept that way and GDB was never updated (supposedly because it needed
> to be compatible with some other tool at the time), leading to other tools copying what GDB was exposing, even though they didn't
> support FPA at all.

The question is only about the hole in the g/G registers layout. where the FPA registers used to be, and the register numbers
for registers that follow.  Nobody is arguing for keeping the FPA support at all, I think.

Just like we have in gdb/features/arm/arm-core.xml:

....
  <reg name="pc" bitsize="32" type="code_ptr"/>

  <!-- The CPSR is register 25, rather than register 16, because
       the FPA registers historically were placed between the PC
       and the CPSR in the "g" packet.  -->
  <reg name="cpsr" bitsize="32" regnum="25"/>
</feature>


That's all we'd need to do in gdb itself too.  Hardly a maintenance burden, IMO, and hardly worth it to break backwards
compatibility with random embedded stubs that are hard or impossible to update, IMO.

> 
> One such example is the Linux Kernel, which added these registers because GDB required them.
> 
> So in this case GDB has the potential to influence other tools, and we should strive to keep things clean and updated as much as
> possible. This is an attempt at that.
> 

Sure.

  reply	other threads:[~2022-10-13  8:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 12:30 Luis Machado
2022-09-20 12:47 ` Eli Zaretskii
2022-10-02 13:39 ` Enze Li
2022-10-03  8:27   ` Luis Machado
2022-10-03 17:33 ` John Baldwin
2022-10-03 19:16 ` Pedro Alves
2022-10-04  8:43   ` Luis Machado
2022-10-04 17:08     ` John Baldwin
2022-10-04 17:43       ` Luis Machado
2022-10-04 21:36         ` John Baldwin
2022-10-05  8:26           ` Luis Machado
2022-10-05  8:36             ` David Spickett
2022-10-05  8:36               ` David Spickett
2022-10-05 16:48             ` John Baldwin
2022-10-05 16:57               ` Richard Earnshaw
2022-10-06 13:02                 ` Luis Machado
2022-10-10 14:58             ` Pedro Alves
2022-10-13  7:23               ` Luis Machado
2022-10-13  8:29                 ` Pedro Alves [this message]
2022-10-13  9:40                   ` Luis Machado
2022-10-25 13:54                     ` Luis Machado
2022-11-14 14:30                     ` Simon Marchi
2022-10-10 14:56     ` Pedro Alves
2022-10-13  7:18       ` Luis Machado
2022-10-13  8:44         ` Pedro Alves
2022-10-13  9:15           ` 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=42083a0b-9723-8bde-470a-247fbb0740eb@palves.net \
    --to=pedro@palves.net \
    --cc=David.Spickett@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=luis.machado@arm.com \
    /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).