I am working on a python application that loads a C++ DLL. In such DLL we do all the heavy work and we want to add Google's breakpad crash report system into it. On Windows, we instanciate an exception handler once that DLL is loaded. However, that exception handler is never called when a crash occurs and the minidump is never written. When we use the same setup for a simple C++ console application, everything works fine. Apparently something prevents the exception handler from being notified only when it is instanciated in a DLL.
How can we make sure that Google's breakpad exception handler is called in a DLL?
Below is the setup we use. Framework is a singleton that is created just before we start to use the DLL.
# include <client/windows/handler/exception_handler.h>
bool callback(
const wchar_t* /*dump_path*/, const wchar_t* /*minidump_id*/,
void* /*context*/, EXCEPTION_POINTERS* /*exinfo*/, MDRawAssertionInfo* /*assertion*/,
bool succeeded )
{
std::cout << "dump callback called" << std::endl;
return succeeded;
}
class Framework
{
Framework()
: handler{ std::make_unique<google_breakpad::ExceptionHandler>(
L".", // dump path
nullptr, // no filter
callback, // to call after writing the minidump
nullptr, // callback does not use context
google_breakpad::ExceptionHandler::HANDLER_ALL ) }
{
std::cout << "Exception handler registered" << std::endl;
}
~Framework()
{
std::cout << "Exception handler destroyed" << std::endl;
}
private:
std::unique_ptr<google_breakpad::ExceptionHandler> handler;
};
P.S. : Breakpad handler works fine in our linux version of the app which has the same setup.
Thanks for your help.