Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

save data from visual studio memory window

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 ?

like image 420
StNickolay Avatar asked Nov 11 '10 14:11

StNickolay


People also ask

How do I access memory in Visual Studio?

Under Debug > Windows > Memory, select Memory 1, Memory 2, Memory 3, or Memory 4. (Some editions of Visual Studio offer only one Memory window.)

How do I find memory leaks in Visual Studio?

To find memory leaks and inefficient memory usage, you can use tools such as the debugger-integrated Memory Usage diagnostic tool or tools in the Performance Profiler such as the . NET Object Allocation tool and the post-mortem Memory Usage tool.


1 Answers

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.

like image 62
StNickolay Avatar answered Oct 06 '22 01:10

StNickolay