cpukit/libmisc/shell/main_mdump.c: Use uintptr_t to print address

The behavior of the %p printf() specifier is implementation
dependent. The behavior varies on RTEMS between printf() and
printk(). This change prints an address as a uintptr_t to
ensure formatting is consistent. It also adjusts the output
width based on target architecture pointer size.

Updates rtems/docs/rtems-docs#163
This commit is contained in:
Joel Sherrill
2026-09-21 15:52:04 +00:00
committed by Vijay Banerjee
parent 1d572e051d
commit 4a76fe0600
+5 -1
View File
@@ -145,7 +145,11 @@ int rtems_mdump(void* addr, int max, int sz)
pb = addr;
for (m=0; m<max; m++) {
cnt = m==(max-1)?res:0xf;
printf("%10p ", pb);
#if (__SIZEOF_POINTER__ == 4)
printf("0x%08" PRIxPTR " ", (uintptr_t) pb);
#else
printf("0x%016" PRIxPTR " ", (uintptr_t) pb);
#endif
if (sz == 1) mdumpB(pb, cnt);
else if (sz == 2) mdumpW(pb, cnt);
else if (sz == 4) mdumpL(pb, cnt);