-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.cpp
41 lines (34 loc) · 958 Bytes
/
demo.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
#include "crashpad_helper.h"
#include <iostream>
#include <filesystem>
#include <client/crashpad_client.h>
namespace fs = std::filesystem;
int function3() {
std::cout << "Entering function3()... BOOM!\n";
memset(NULL, 1, 1);
return 0;
}
int function2() {
std::cout << "Entering function2()\n";
return function3();
}
int function1() {
std::cout << "Entering function1()\n";
return function2();
}
crashpad::CrashpadClient * initCrashpad() {
fs::path db = fs::absolute(fs::path("crashpad_db"));
fs::create_directory(db);
fs::path crashpadHandlerPath = fs::path (CRASHPAD_HANDLER_DIR) / CRASHPAD_HANDLER_NAME;
return init("crashpaddemo", "0.1", crashpadHandlerPath.native(), db.native());
}
int main() {
std::cout << "Entering main()\n";
auto client = initCrashpad();
if (client == nullptr) {
std::cout << "Crashpad failed to unitialize.";
return -1;
}
function1();
return 0;
}