tomato/src/breakpad_client.cpp

39 lines
1.2 KiB
C++
Raw Normal View History

2024-11-12 12:53:39 +01:00
#include "./breakpad_client.hpp"
2024-11-12 16:23:02 +01:00
#ifdef WIN32
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;
}
#else
// linux
2024-11-12 12:53:39 +01:00
bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void*, bool succeeded) {
2024-11-12 16:23:02 +01:00
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());
}
2024-11-12 12:53:39 +01:00
return succeeded;
}
2024-11-12 16:23:02 +01:00
#endif