Re: Question Regarding Int Cast Error in GDB Python
Vacha Bhavsar via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAEWVDmvHpFFQSEd73_2pLywbgmZ=NkVFFi43Y39zj4vTuOR3mg@mail.gmail.com> |
Hi,
We are testing the ZA by tiles and tile slices. I've included a larger
snippet
of the code below:
for i in range(0, 4):
for j in range(0, 4):
for k in range(0, 4):
cmd = "set $za%dhq%d[%d] = 0x%x" % (i, j, k, MAGIC)
gdb.execute(cmd)
report(True, "%s" % cmd)
for j in range(0, 4):
for k in range(0, 4):
reg = "$za%dhq%d[%d]" % (i, j, k)
v = gdb.parse_and_eval(reg)
report(str(v.type) == "uint128_t",
"size of %s" % (reg))
report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC))
So in this case we see the error when we try to test za0hq0[0] when
v is cast to an int.
On Mon, Aug 25, 2025 at 4:35 AM Luis <[email protected]> wrote:
> On 8/22/25 19:21, Vacha Bhavsar via Gdb wrote:
> > Hi,
> >
> > I am developing a patch for QEMU which would allow QEMU to expose
> > SME registers, such as the ZA storage, via gdbstub to a remote
> > gdb client session. I am working to write a simple test case for
> > this change which simply sets the value of the za register, then
> > reads it and ensures what is read is equivalent to what was set.
> >
> > The full test case can be found here:
> >
> > https://lists.gnu.org/archive/html/qemu-devel/2025-08/msg01815.html
> >
> > However, it seems there is an issue in the int cast in the following
> > code:
> >
> > v = gdb.parse_and_eval(reg)
> > report(str(v.type) == "uint8_t", "size of %s" % (reg))
> > report(int(v) == 0x1, "%s is 0x%x" % (reg, 0x1))
>
> If reg is ZA, I´d expect gdb to have difficulties casting the whole
> array to an int, hence the message about not managing to operate on
> integers larger than 8 bytes.
>
> How are you testing ZA? Byte by byte?
>
> >
> > This results in the following error:
> >
> > Python Exception <class 'gdb.error'>: That operation is not available
> > on integers of more than 8 bytes.
> > Error occurred in Python: That operation is not available on integers
> > of more than 8 bytes.
> >
> > After running various tests with different host architectures, gdb
> > versions, python version and int casting included and excluded, we
> > are seeing that this issue only seems to arise when the int cast is
> > included and the gdb used is GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1)
> > 15.0.50.20240403-git (regardless of python version and host
> architecture).
> >
> > The test results are presented below. I was hoping to get some guidance
> > regarding this error and what may be the cause if it indeed stems from
> > this specific version of gdb?
> >
> > Thanks,
> > Vacha
> >
> >
> > gdb gdb target python host int cast status
> > version support version architecture
> > 16.3 --enable-targets=all 3.11.13 x86 yes pass
> > 16.3 --enable-targets=all 3.11.13 x86 no pass
> > 16.3 --enable-targets=all 3.10.18 x86 yes pass
> > 16.3 --enable-targets=all 3.10.18 x86 no pass
> > 16.3 --enable-targets=all 3.8.10 x86 yes pass
> > 16.3 --enable-targets=all 3.8.10 x86 no pass
> >
> > 16.3 aarch64 3.11.0rc1 aarch64 yes pass
> > 16.3 aarch64 3.11.0rc1 aarch64 no pass
> > 16.3 aarch64 3.10.12 aarch64 yes pass
> > 16.3 aarch64 3.10.12 aarch64 no pass
> >
> > 15.0 multiarch 3.10.12 aarch64 yes fail
> > 15.0 multiarch 3.10.12 aarch64 no pass
> > 15.0 multiarch 3.11.0rc1 aarch64 yes fail
> > 15.0 multiarch 3.11.0rc1 aarch64 no pass
> >
> > 15.0 multiarch 3.8.10 x86 yes fail
> > 15.0 multiarch 3.8.10 x86 no pass
> > 15.0 multiarch 3.11.13 x86 yes fail
> > 15.0 multiarch 3.11.13 x86 no pass
> > 15.0 multiarch 3.10.18 x86 yes fail
> > 15.0 multiarch 3.10.18 x86 no pass
>
>