Binary Dump via GDB
October 2, 2025
Recently at work, I’ve been relying on a very handy tool on GDB called dump memory
to dump the contents of any contiguous range of memory.
I first came aware of this tool from a stackoverflow answer
that a coworker linked as each of us had a need to dump the contents of memory copied from the GPU to the host memory for our respective tickets.
Syntax: dump memory <filename> <starting address> <ending address>
For instance,
dump memory vectorData.bin 0x7ffff2d96010 0x7ffff53bba10
or suppose you have a vector vec
, you could dump the contents of the vector via:
dump memory vectorData.bin vec.data() vec.data()+vec.size()