I have a void* and I think there's a string nearby, somewhere within the next few bytes, but I'm not sure where. I don't know have any other knowledge of the what's nearby in memory, including whether there are 0s, so casting to char* isn't what I want. How can I print the next 20 bytes from this pointer as characters?
Use the “x“ command to display the memory contents at a given address using the specified format.
Syntax:
x [Address expression]
x /[Format] [Address expression]
x /[Length][Format] [Address expression]
Dumps 20 bytes as characters:
x/20c voidptr
Dumps 20 bytes as hex:
x/20x voidptr
See GDB command reference for x command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With