[PATCH 19/27] gdb: %p => host_address_to_string, dump_for_expression

Pedro Alves <[email protected]> Thu, 23 Jul 2026 14:01:10 +0100
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Use host_address_to_string in dump_for_expression, which always
renders a host pointer with a "0x" prefix regardless of the C runtime,
as GDB does elsewhere for this reason.

Tested on x86_64-pc-linux-gnu and x86_64-pc-windows-msvc.

Change-Id: Icd754e4b996c93adfd1a6cd67265ee3857762b30
---
 gdb/expprint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/expprint.c b/gdb/expprint.c
index e99430d2325..45bad7a516d 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -131,7 +131,8 @@ dump_for_expression (struct ui_file *stream, int depth,
 void
 dump_for_expression (struct ui_file *stream, int depth, const block *bl)
 {
-  gdb_printf (stream, _("%*sBlock: %p\n"), depth, "", bl);
+  gdb_printf (stream, _("%*sBlock: %s\n"), depth, "",
+	      host_address_to_string (bl));
 }
 
 void
-- 
2.54.0