Re: gdb support for SME-without-SVE ?

Peter Maydell via Gdb
2026-01-29T09:10:54Z

On Thu, 29 Jan 2026 at 04:12, Thiago Jung Bauermann
<thiago.bauermann@linaro.org> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
> > On Wed, 28 Jan 2026 at 04:24, Thiago Jung Bauermann
> > <thiago.bauermann@linaro.org> wrote:
> >> I'm currently implementing SME-only (i.e. without SVE) support in GDB
> >> for Linux userspace debugging. It's mostly done, I just need to test a
> >> few things, polish the code and prepare the patches. I'm hoping to send
> >> the patches next week.
> >
> > Let me know if a QEMU setup emulating "SME only" would be helpful
> > for you with that.
>
> It would indeed! If there's a branch I can build, it would make my
> testing quicker, and the regression testing more complete.

I'll get one sorted out later today (the patches I have right now
have a few issues I need to fix).

> >> Due to the limitations in the remote protocol that Luis mentioned below,
> >> I can't run the tests against a remote target so I'm only focusing on
> >> local debugging, unfortunately.
> >
> > What does gdb need to do differently for "SME only" vs "SME + SVE" ?
>
> There are two changes:
>
> 1. GDB assumed that whenever SME was available, then SVE was too and it
> would try to also fetch the SVE register set when it decided to fetch
> the SME register set.
>
> 2. Since GDB pretends the SVE register set (i.e., the
> org.gnu.gdb.aarch64.sve XML feature) is always there, when the SVE
> register set is needed and the inferior isn't in streaming mode then
> GDB needs to fetch/set the FPSIMD register set instead, and pretend
> that VL is 128 bits as you mentioned.
>
> > What I'm wondering is, if for the remote protocol we define/redefine:
> > - org.gnu.gdb.aarch64.sve is how the Z registers are exposed; its
> > 'vg' tells you the size of the Z regs (either "max size" as
> > currently, or eventually "current size", 128 bits if Z regs
> > not currently exposed)
> > - org.gnu.gdb.aarch64.sme is how the ZA array is exposed; its
> > 'svg' tells you the size of the ZA array
> >
> > then does this break something subtly ? I think with current gdb
> > it would let you at least access all the registers without it
> > falling over. gdb wouldn't be able to tell the difference between
> > "SME only" and "SME + SVE" if we define things this way; but we
> > could add a new thing somewhere if it needs that information.
>
> I think that should work fine. If the stub can always provide and accept
> values for the Z registers, and if the Z registers have the size that
> the VG register says they should have then GDB will be happy.
>
> The changes I mentioned above stem from the fact that ptrace() rejects
> calls referencing the NT_ARM_SVE regset in SME-only, and only allow
> NT_ARM_SSVE if the inferior is in streaming mode. The remote protocol
> doesn't need to expose these restrictions.

Great. I'll move forward on that assumption for my prototype
patches. I might have a go at a proposed documentation patch
that writes up the above as the defined requirements, but that
will be the last thing on my todo list so if anybody else would
like to do that please feel free.

thanks
-- PMM