I'm trying to integrate Google Breakpad into a Windows Qt project.
When I compile it with MinGW(not w64), the Breakpad worked as expected and generated a Minidump file when the app crashes.
However, when I compile the same code with MinGW-w64, the app just crashes scielently without the Minidump file.
This issue can be reproduced by a simple test program:
#include "breakpad/client/windows/handler/exception_handler.h"
#include "breakpad/client/windows/sender/crash_report_sender.h"
void test()
{
// install the exception handler
std::wstring prod(L"some prod");
std::wstring ver(L"some ver");
std::wstring subver(L"some subver");
static google_breakpad::CustomInfoEntry custom_entries[] = {
google_breakpad::CustomInfoEntry(L"prod", prod.c_str()),
google_breakpad::CustomInfoEntry(L"ver", ver.c_str()),
google_breakpad::CustomInfoEntry(L"subver", subver.c_str()),
};
static google_breakpad::CustomClientInfo custom_info = {custom_entries, 3};
std::wstring path(L"some/path/to/dump/file");
auto handler = new google_breakpad::ExceptionHandler(path, nullptr, nullptr, nullptr, google_breakpad::ExceptionHandler::HANDLER_ALL, MiniDumpNormal, (const wchar_t *)nullptr, &custom_info);
// feed crash
*(int*)0x1 = 1;
}
int main()
{
test();
return 0;
}
The code is compiled together with the Breakpad source tree (not as a binary library)
It seems like that the exception handler is not called. A callback function will not be called if I register it to the ctor of google_breakpad::ExceptionHandler
.
So why does it happen? Is it possible to integrate Breakpad into a MinGW-w64-compiled project?