Ted Middleton
Ted Middleton

Reputation: 7274

Best place to call MiniDumpWriteDump() to catch a crash

I have a large-ish Win32 program that I'm maintaining, and I'd like to instrument it to automatically and unconditionally generate a minidump file whenever something bad happens. I can't ask customers to install userdump.exe, and I can't ask them to install visual studio.

Is there a good way of doing this? I'd like to be able to generate a minidump whether abort() is called from our assert handler (which is complicated), whether someone touches bad memory, or anything else really bad happens.

On Posix, I'd install a signal handler and be done with this. My understanding is that the equivalent approach on Windows is SEH, but our program starts up a lot of threads in a lot of different places so it would be very painful to wrap every thread entry point with a __try/__catch.

Ideas?

Upvotes: 1

Views: 713

Answers (1)

Yuriy Pryyma
Yuriy Pryyma

Reputation: 593

There are google breakpad client and server components for catching crashes. You could use this lib

Also you could register your filter(could check for different expedition types ) callback for handling exceptions using AddVectoredExceptionHandler.

I hope it helped

Upvotes: 1

Related Questions