* Question Regarding Int Cast Error in GDB Python @ 2025-08-22 18:21 Vacha Bhavsar via Gdb 2025-08-25 8:35 ` Luis via Gdb 2025-08-29 17:46 ` Tom Tromey 0 siblings, 2 replies; 8+ messages in thread From: Vacha Bhavsar via Gdb @ 2025-08-22 18:21 UTC (permalink / raw) To: gdb 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)) 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question Regarding Int Cast Error in GDB Python 2025-08-22 18:21 Question Regarding Int Cast Error in GDB Python Vacha Bhavsar via Gdb @ 2025-08-25 8:35 ` Luis via Gdb 2025-08-25 13:23 ` Vacha Bhavsar via Gdb 2025-08-29 17:46 ` Tom Tromey 1 sibling, 1 reply; 8+ messages in thread From: Luis via Gdb @ 2025-08-25 8:35 UTC (permalink / raw) To: Vacha Bhavsar, gdb 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question Regarding Int Cast Error in GDB Python 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 0 siblings, 1 reply; 8+ messages in thread From: Vacha Bhavsar via Gdb @ 2025-08-25 13:23 UTC (permalink / raw) To: Luis; +Cc: gdb 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 > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question Regarding Int Cast Error in GDB Python 2025-08-25 13:23 ` Vacha Bhavsar via Gdb @ 2025-08-25 13:29 ` Vacha Bhavsar via Gdb 2025-08-26 20:49 ` Luis via Gdb 0 siblings, 1 reply; 8+ messages in thread From: Vacha Bhavsar via Gdb @ 2025-08-25 13:29 UTC (permalink / raw) To: Luis; +Cc: gdb 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 >> >> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question Regarding Int Cast Error in GDB Python 2025-08-25 13:29 ` Vacha Bhavsar via Gdb @ 2025-08-26 20:49 ` Luis via Gdb 2025-08-27 19:16 ` Vacha Bhavsar via Gdb 0 siblings, 1 reply; 8+ messages in thread From: Luis via Gdb @ 2025-08-26 20:49 UTC (permalink / raw) To: Vacha Bhavsar; +Cc: gdb Hi, On 8/25/25 14:29, Vacha Bhavsar wrote: > 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)) Right, so gdb doesn't like casting integers to/from 8+ bytes. That's a limitation currently. But why are you considering this particular cast? To optimize the checks instead of using the byte vectors? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question Regarding Int Cast Error in GDB Python 2025-08-26 20:49 ` Luis via Gdb @ 2025-08-27 19:16 ` Vacha Bhavsar via Gdb 0 siblings, 0 replies; 8+ messages in thread From: Vacha Bhavsar via Gdb @ 2025-08-27 19:16 UTC (permalink / raw) To: Luis; +Cc: gdb Hi, We chose this particular cast just to stay aligned with the existing method of testing in QEMU which also uses this cast but for 64bit integers. qemu/tests/tcg/aarch64/gdbstub/test-sve.py at b86307ecef9222c335ebd0ed4da2b243e86f779e · qemu/qemu <https://github.com/qemu/qemu/blob/b86307ecef9222c335ebd0ed4da2b243e86f779e/tests/tcg/aarch64/gdbstub/test-sve.py> https://lists.gnu.org/archive/html/qemu-devel/2025-08/msg01815.html However, since we have seen that this issue only occurs with the specific indiciated version of gdb, and does not fail for example with gdb16.3, we have implemented a workaround to avoid the casting in the case of gdb-multiarch 15.0.50.20240403-0ubuntu1. Thank you for confirming this is a known issue! Thanks, Vacha On Tue, Aug 26, 2025 at 4:49 PM Luis <luis.machado.foss@gmail.com> wrote: > Hi, > > On 8/25/25 14:29, Vacha Bhavsar wrote: > > 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)) > > Right, so gdb doesn't like casting integers to/from 8+ bytes. That's a > limitation currently. But why are you considering this particular cast? > To optimize the checks instead of using the byte vectors? > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question Regarding Int Cast Error in GDB Python 2025-08-22 18:21 Question Regarding Int Cast Error in GDB Python Vacha Bhavsar via Gdb 2025-08-25 8:35 ` Luis via Gdb @ 2025-08-29 17:46 ` Tom Tromey 2025-09-03 18:59 ` Vacha Bhavsar via Gdb 1 sibling, 1 reply; 8+ messages in thread From: Tom Tromey @ 2025-08-29 17:46 UTC (permalink / raw) To: Vacha Bhavsar via Gdb; +Cc: Vacha Bhavsar >>>>> ">" == Vacha Bhavsar via Gdb <gdb@sourceware.org> writes: >> 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)) >> This results in the following error: >> Python Exception <class 'gdb.error'>: That operation is not available >> on integers of more than 8 bytes. I think this is just a bug. Would you mind filing it in bugzilla? python/py-value.c:valpy_long uses value_as_long. However if it used value_as_mpz instead, it could handle types wider than 64 bits. Tom ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Question Regarding Int Cast Error in GDB Python 2025-08-29 17:46 ` Tom Tromey @ 2025-09-03 18:59 ` Vacha Bhavsar via Gdb 0 siblings, 0 replies; 8+ messages in thread From: Vacha Bhavsar via Gdb @ 2025-09-03 18:59 UTC (permalink / raw) To: Tom Tromey; +Cc: Vacha Bhavsar via Gdb I have filed this in bugzilla. Thanks, Vacha On Fri, Aug 29, 2025 at 1:46 PM Tom Tromey <tom@tromey.com> wrote: > >>>>> ">" == Vacha Bhavsar via Gdb <gdb@sourceware.org> writes: > > >> 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)) > > >> This results in the following error: > > >> Python Exception <class 'gdb.error'>: That operation is not available > >> on integers of more than 8 bytes. > > I think this is just a bug. Would you mind filing it in bugzilla? > > python/py-value.c:valpy_long uses value_as_long. However if it used > value_as_mpz instead, it could handle types wider than 64 bits. > > Tom > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-09-03 19:00 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-08-22 18:21 Question Regarding Int Cast Error in GDB Python 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox