-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
52 lines (49 loc) · 1.52 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#if defined _WIN32
#include "client/windows/handler/exception_handler.h"
#elif defined __APPLE__
#include "client/mac/handler/exception_handler.h"
#else
#include "client/linux/handler/exception_handler.h"
#endif
static bool dumpCallback(
#if defined _WIN32
const wchar_t* dump_path,
const wchar_t* minidump_id,
void *context,
EXCEPTION_POINTERS* exinfo,
MDRawAssertionInfo* assertion,
#elif defined __APPLE__
const char* dump_dir,
const char* minidump_id,
void *context,
#else
const google_breakpad::MinidumpDescriptor& descriptor,
void *context,
#endif
bool succeeded
) {
#if defined _WIN32
std::wcout << L"dump_path: " << dump_path << std::endl;
std::wcout << L"minidump_id: " << minidump_id << std::endl;
#elif defined __APPLE__
std::cout << "dump_dir: " << dump_dir << std::endl;
std::cout << "minidump_id: " << minidump_id << std::endl;
#else
std::cout << "Dump path: " << descriptor.path() << std::endl;
#endif
return succeeded;
}
int main(int, char**) {
#if defined _WIN32
google_breakpad::ExceptionHandler handler(L".", nullptr, dumpCallback, nullptr, google_breakpad::ExceptionHandler::HANDLER_ALL);
#elif defined __APPLE__
google_breakpad::ExceptionHandler handler(".", nullptr, dumpCallback, nullptr, true, nullptr);
#else
google_breakpad::MinidumpDescriptor descriptor(".");
google_breakpad::ExceptionHandler handler(descriptor, nullptr, dumpCallback, nullptr, true, -1);
#endif
// crash
int *a = nullptr;
*a = 1;
}