]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
scripts/qemugdb: mtree: Fix OverflowError in mtree with 128-bit addresses
authorAndrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Thu, 4 Dec 2025 10:50:16 +0000 (12:50 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 9 Feb 2026 14:24:49 +0000 (09:24 -0500)
The 'qemu mtree' command fails with "OverflowError: int too big to
convert" when memory regions have 128-bit addresses.

Fix by changing conversion base from 16 to 0 (automatic detection based
on string prefix).  This works more reliably in GDB's embedded
Python.

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20251204105019.455060-2-andrey.drobyshev@virtuozzo.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scripts/qemugdb/mtree.py

index 8fe42c3c12d57c39f690563ea515385607ea879b..77603c04b12d45433f36220d08c7726259ad0d9f 100644 (file)
@@ -25,7 +25,7 @@ def int128(p):
     if p.type.code == gdb.TYPE_CODE_STRUCT:
         return int(p['lo']) + (int(p['hi']) << 64)
     else:
-        return int(("%s" % p), 16)
+        return int(("%s" % p), 0)
 
 class MtreeCommand(gdb.Command):
     '''Display the memory tree hierarchy'''