From: Peter Maydell <peter.maydell@linaro.org>
To: Luis <luis.machado.foss@gmail.com>
Cc: gdb-patches@sourceware.org,
Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Subject: Re: [PATCH] docs: Clarify gdb remote protocol AArch64 SVE and SME handling
Date: Fri, 13 Feb 2026 12:15:36 +0000 [thread overview]
Message-ID: <CAFEAcA-_tea_zdzb35aj4_xCjG_DTcDCxTt8doE7Egj4Xykwtw@mail.gmail.com> (raw)
In-Reply-To: <3624e27d-52f6-4523-b9e4-f41f6ca48548@gmail.com>
On Fri, 13 Feb 2026 at 11:39, Luis <luis.machado.foss@gmail.com> wrote:
>
> On 09/02/2026 09:36, Peter Maydell wrote:
> > On Mon, 2 Feb 2026 at 23:41, Luis <luis.machado.foss@gmail.com> wrote:
> >> Remote debug *kinda* just works, unfortunately. In reality remote
> >> debugging with SVE/SME is not properly supported because the remote
> >> target cannot communicate vg/svg changes to gdb, and that messes things
> >> up badly.
> >
> > The vg/svg won't generally change without gdb knowing about it,
> > though -- presumably gdb could read it whenever the target stops,
> > even if there's no mechanism for actively reporting a change ?
> >
>
> The problem is the register buffer size changes according to the vg
> size. If we let the program run on the remote and it eventually changes
> vg, the next time it stops the remote will report a block of registers
> with a size gdb is not expecting. So this is the problematic case.
At least in QEMU's implementation, it doesn't, though: the register
data type reported by the stub is fixed to the worst-case Z reg
size: we generate the XML for the target up-front and there's
no mechanism for changing it dynamically later.
I assumed this was why there's a separate 'vg' pseudoreg,
so gdb knows how to interpret the data in there and that the
tail end of it might be junk/to be ignored.
> > For the moment I would like to fix the QEMU gdbstub for the SVE + SME
> > case, so that it at least reports the Z regs as having their actual
> > maximum possible size (currently it reports them as having the max size
> > for SVE only, even though it reports the 'vg' pseudoreg as being the
> > SVE+SME current width).
>
> What gdb expects is the remote reporting Z registers that match the
> actual size based on vg (no streaming mode) or svg (streaming mode).
>
> By maximum size, do you mean QEMU always reports whatever maximum we
> have between vg/svg?
Current QEMU behaviour (some of which I think is bugs on our side) is:
* the Z regs in the SVE feature XML have the width of the worst-case
possible SVE vector size for this CPU (even if SME vectors are bigger)
* the predicate regs in the SVE feature similarly are based on
worst possible SVE vector size
* the vq pseudoreg in the sve feature reports the current
effective vector length (i.e. SVE VL when in non-streaming mode,
SME VL when in streaming mode)
* the SME ZA array in the XML is sized for the worst-case
possible SME vector size
* the SME svg pseudoreg reports the SME streaming VL when in
streaming mode, and reads as zero when not in streaming mode
The QEMU patch I linked to earlier changes the first two of these
(Z and predicate reg size) to "width of the worst case possible
SVE or SME vector size" (so it lines up with our interpretation
of the meaning of the "vq" pseudoreg, and allows the debugger
to see the whole of a Z reg in streaming SVE mode, and doesn't
make gdb crash if there's no SVE and we claim the Z regs to
have 0 size).
thanks
-- PMM
next prev parent reply other threads:[~2026-02-13 12:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 18:11 Peter Maydell
2026-01-29 23:13 ` Luis
2026-01-30 9:36 ` Peter Maydell
2026-02-02 23:41 ` Luis
2026-02-09 9:36 ` Peter Maydell
2026-02-13 11:39 ` Luis
2026-02-13 12:15 ` Peter Maydell [this message]
2026-03-19 13:41 ` Peter Maydell
2026-03-20 3:02 ` Thiago Jung Bauermann
2026-03-20 9:25 ` Peter Maydell
2026-01-30 11:37 ` Eli Zaretskii
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=CAFEAcA-_tea_zdzb35aj4_xCjG_DTcDCxTt8doE7Egj4Xykwtw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado.foss@gmail.com \
--cc=manos.pitsidianakis@linaro.org \
--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