windows breakpad
This commit is contained in:
@ -1,10 +1,38 @@
|
||||
#include "./breakpad_client.hpp"
|
||||
|
||||
// if linux
|
||||
#ifdef WIN32
|
||||
|
||||
bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void*, bool succeeded) {
|
||||
fprintf(stderr, "Crash detected, MiniDump written to: %s\n", descriptor.path());
|
||||
bool dumpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded) {
|
||||
//TCHAR* text = new TCHAR[kMaximumLineLength];
|
||||
//text[0] = _T('\0');
|
||||
//int result = swprintf_s(text,
|
||||
// kMaximumLineLength,
|
||||
// TEXT("Dump generation request %s\r\n"),
|
||||
// succeeded ? TEXT("succeeded") : TEXT("failed"));
|
||||
//if (result == -1) {
|
||||
// delete [] text;
|
||||
//}
|
||||
|
||||
//QueueUserWorkItem(AppendTextWorker, text, WT_EXECUTEDEFAULT);
|
||||
|
||||
if (succeeded) {
|
||||
fprintf(stderr, "Crash detected, MiniDump written to: %ls\n", dump_path);
|
||||
} else {
|
||||
fprintf(stderr, "Crash detected, failed to write MiniDump. (path: %ls)\n", dump_path);
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
// endif linux
|
||||
#else
|
||||
// linux
|
||||
|
||||
bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void*, bool succeeded) {
|
||||
if (succeeded) {
|
||||
fprintf(stderr, "Crash detected, MiniDump written to: %s\n", descriptor.path());
|
||||
} else {
|
||||
fprintf(stderr, "Crash detected, failed to write MiniDump. (path: %s)\n", descriptor.path());
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// TODO: if linux/android
|
||||
// TODO: require msvc
|
||||
#ifdef WIN32
|
||||
|
||||
#include <client/windows/handler/exception_handler.h>
|
||||
|
||||
bool dumpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded);
|
||||
|
||||
#define BREAKPAD_MAIN_INIT \
|
||||
google_breakpad::ExceptionHandler bp_eh{ \
|
||||
L".\\", /* path */ \
|
||||
nullptr, \
|
||||
dumpCallback, \
|
||||
nullptr, \
|
||||
google_breakpad::ExceptionHandler::HANDLER_ALL, \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <client/linux/handler/exception_handler.h>
|
||||
|
||||
@ -19,4 +35,4 @@ bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void*,
|
||||
-1, /* dump in-process (OOP would be better) */ \
|
||||
}
|
||||
|
||||
// endif linux
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user