Joel Sherrill commented on a discussion on shell/memory_commands.md: 
https://gitlab.rtems.org/rtems/docs/rtems-docs/-/merge_requests/261#note_159084

 >  : The following is an example of how to use `mdump`:
 >  
 >    ```shell
 > -  SHLL [/] $ mdump 0x10000 32
 > -  0x0001000000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
 > -  0x0001001000 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
 > -  SHLL [/] $ mdump 0x02000000 32
 > -  0x02000000A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 00 .H..)..3.."...!.
 > -  0x02000010A1 48 00 00 29 00 80 33-81 C5 22 BC A6 10 21 01 .H..)..3.."...!.
 > -  SHLL [/] $ mdump 0x02001000 32
 > -  0x0200100003 00 80 00 82 10 60 00-81 98 40 00 83 48 00 00 ......`.....H..
 > -  0x0200101084 00 60 01 84 08 A0 07-86 10 20 01 87 28 C0 02 ..`....... ..(..
 > +  SHLL [/] # mdump 0x40000000 32
 > +    40000000 A0 10 00 00 29 10 00 04-81 C5 20 00 A6 10 20 00 ....)..... ... 
 > .

Looking back in the history of _mdump_ to the very first version, it was not 
using %p but did print the 0x.

`    fprintf(stdout,"0x%08X ",addr);`

I'm unsure where the output without 0x as in the documentation came from.

>From the 
>[printf](https://pubs.opengroup.org/onlinepubs/9799919799/functions/fprintf.html)
> specification in POSIX Issue 8:   

```
p
The argument shall be a pointer to void. The value of the pointer is converted 
to a sequence of printable characters, in an implementation-defined manner.
```

Further, glibc on Rocky 9 has this output for the 
attached[void_printf.c](/uploads/4308aba041bd5945ce5ccc2825d17aa7/void_printf.c)
 program.

```
p=0x12345689abcdef0
main=0x401126
```

The only way to have any **defined** formatted output for %p is to cast the 
value as a _uintptr_t_ and use another specifier.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/docs/rtems-docs/-/merge_requests/261#note_159084
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/namespace/19/sent_notifications/5-bkvt0n35atfcn549b7365ubrv-j/unsubscribe
 | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | 
Help: https://gitlab.rtems.org/help


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to