save data from visual studio memory window

StNickolay picture StNickolay · Nov 11, 2010 · Viewed 13k times · Source

Is any possiblility to save some buffer in any binary file, to view in standalone hex editor.

For example, can I save data from memory window in VS to hex dump, but not as ASCII ?

Answer

StNickolay picture StNickolay · Nov 5, 2011

user142207 has done a great job investigating VS internals, I recommend that solution. I have another way that was invented by my colleague, Sergey S., which is very useful:

Windows: Use a couple of functions ReadProcessMemory/WriteProcessMemory. It needs a standalone app that calls these functions with a target process id like:

dumper.exe <debugged process id> <memory_start_addr> <memory_length>

This app can be called directly during the VS debug session(compared to Linux, which doesn't have such a possibility). We can capture the memory address in the watch window, then pass the address to the dumper and voila. As user142207 says in his article, it's very useful in long-time recompiled projects.

Linux/MacOS has different approaches. For example: from the gdb console, use command dump memory. This command can also be used directly during the debug session.