@samitouri / QOSamiQemu / commits / 083072dba0

monitor: Correctly display virtual addresses while dumping memory

While reworking the address format width in commit 6ad593a75a8 we introduce a bug, leading to addresses being displayed with too many zeroes: $ qemu-system-ppc -monitor stdio -S QEMU 10.2.90 monitor - type 'help' for more information (qemu) x/x 0 0000000000000000000000000000000000000000000000000000000000000000: 0x00000000 (qemu) x/x 0xfff00000 00000000000000000000000000000000000000000000000000000000fff00000: 0x60000000 $ qemu-system-ppc64 -monitor stdio -S QEMU 10.2.90 monitor - type 'help' for more information (qemu) x/x 0 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000: 0x00000000 Correct the format width to restore the previous behavior: $ qemu-system-ppc -monitor stdio -S QEMU 10.2.90 monitor - type 'help' for more information (qemu) x/x 0 00000000: 0x00000000 $ qemu-system-ppc64 -monitor stdio -S QEMU 10.2.90 monitor - type 'help' for more information (qemu) x/x 0 0000000000000000: 0x00000000 Fixes: 6ad593a75a8 ("monitor/hmp: Use plain uint64_t @addr argument in memory_dump()") Reported-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20260323095020.66658-1-philmd@linaro.org>

Philippe Mathieu-Daudé committed Mar 23, 2026 at 10:44 UTC 083072dba096e03f86db8962c83101b679bcc533
1 file changed +1 -1
monitor/hmp-cmds.c
+1 -1
@@ -537,7 +537,7 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
537 uint8_t buf[16];
538 uint64_t v;
539 CPUState *cs = mon_get_cpu(mon);
540 - const unsigned int addr_width = is_physical ? 8 : (target_long_bits() * 2);
540 + const unsigned int addr_width = is_physical ? 8 : (target_long_bits() / 4);
541 const bool big_endian = target_big_endian();
542
543 if (!cs && (format == 'i' || !is_physical)) {