How to create a minidump for a child process when it crashes?

1k Views Asked by At

I have code to output a minidump when my process has an exception, but I'd like to move that code to a parent process so that one doesn't corrupt the other.

How would one go about (1.) listening for a child process crash from a wrapper process, and (2.) writing a minidump as a result?

C++ would seem the most natural choice of language for the wrapper process, but .NET is also an option for me (my app is mixed C#/C++).

1

There are 1 best solutions below

0
On

As far as I know there are only two ways to do this. One would be to use the Debugging APIs to "debug" the child process and write a minidump when an exception is encountered. I've never tried this, but I've heard it can cause issues because the Debugger API isn't really intended to be used this way.

The other is to set up a communication channel between the parent and child processes ahead of time and then register an unhandled exception filter in the child process that signals the parent process to write a minidump. Both Firefox and Chrome use this method for exception handling for their child processes via the Breakpad library. If you'd like to use Breakpad then you'd be using the CrashGenerationServer class in the parent process, and in the child process the ExceptionHandler constructor that takes either a pipe name or pipe handle as the other end of the communication channel to the CrashGenerationServer.