From: Vacha Bhavsar via Gdb <gdb@sourceware.org>
To: Luis <luis.machado.foss@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Question Regarding Int Cast Error in GDB Python
Date: Mon, 25 Aug 2025 09:29:35 -0400 [thread overview]
Message-ID: <CAEWVDmt87GgX6xyBzYLkzHME_ja7G1daTbD1jOWgHNBRygPpLw@mail.gmail.com> (raw)
In-Reply-To: <CAEWVDmvHpFFQSEd73_2pLywbgmZ=NkVFFi43Y39zj4vTuOR3mg@mail.gmail.com>
Hi,
Apologies, it seems I pasted the wrong snippet in the original email.
The code in my reply just prior to this is the correct code. The snippet
that
should have been included in the first email, which causes the error, is
the one below:
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))
Sorry for the confusion!
On Mon, Aug 25, 2025 at 9:23 AM Vacha Bhavsar <
vacha.bhavsar@oss.qualcomm.com> wrote:
> 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 <luis.machado.foss@gmail.com> 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
>>
>>
next prev parent reply other threads:[~2025-08-25 13:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 18:21 Vacha Bhavsar via Gdb
2025-08-25 8:35 ` Luis via Gdb
2025-08-25 13:23 ` Vacha Bhavsar via Gdb
2025-08-25 13:29 ` Vacha Bhavsar via Gdb [this message]
2025-08-26 20:49 ` Luis via Gdb
2025-08-27 19:16 ` Vacha Bhavsar via Gdb
2025-08-29 17:46 ` Tom Tromey
2025-09-03 18:59 ` Vacha Bhavsar via Gdb
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=CAEWVDmt87GgX6xyBzYLkzHME_ja7G1daTbD1jOWgHNBRygPpLw@mail.gmail.com \
--to=gdb@sourceware.org \
--cc=luis.machado.foss@gmail.com \
--cc=vacha.bhavsar@oss.qualcomm.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