I am currently trying to design a memory dump tool that could get the memory dump of a crashed process from another process. But I am totally new to this and I want to take this as an opportunity to get a solid understanding of memory dump techniques.
I want to know the working paradigm of creating a memory dump for the crashed process. My current wild imagination is like below:
When a process crashed, the operating system will always know that (I don't know how but it should be able to). Then the OS launched some kind of mechanism to copy the content of the crashed process' virtual address space to the so-called dump file. Then we could use WinDbg to debug with the dump file.
I am wondering, if we can copy the whole of the virtual address space of the crashed process into the dump file, would't the file be too huge? Or could we specify which virtual address space (kernel/user) to dump?
Could anyone provide me some references for me to start with, especially on the following aspects:
what is memory dump?
If there are so-called kernel dump and user-mode dump, what are they?
On windows platform, what APIs will I need? Would functions such as MiniDumpWriteDump() be relevant?
When OS detect certain process crashed, is there any signal that I can monitor so that my Dump Tool will be notified to start dumping?
Thanks for taking time to see my words.
ADD1:
(5) What are mini-dumps? How is it related to kernel/user mode dumps?
(6) When we talk about memory dump, which memory are we talking about? Virtual Memory or Physical Memory? From this picture, I think it should be Physical Memory.
ADD2:
I just found a good reference about writing MiniDump with APIs contained in DbgHelp.dll. I'd like to share it. If you can provide other good materials related to this, would you mind sharing it? Thanks.
(BTW: I will keep updating this thread with my progress. Any comments would be deeply appreciated.)