|
Lines 1-7
Link Here
|
| 1 |
#include "CrashReporter.hpp" |
1 |
#include "CrashReporter.hpp" |
| 2 |
#include <random> |
2 |
#include <random> |
| 3 |
#include <sys/utsname.h> |
3 |
#include <sys/utsname.h> |
| 4 |
#include <execinfo.h> |
|
|
| 5 |
#include <fstream> |
4 |
#include <fstream> |
| 6 |
#include <signal.h> |
5 |
#include <signal.h> |
| 7 |
|
6 |
|
|
Lines 81-90
void CrashReporter::createAndSaveCrash(int sig) {
Link Here
|
| 81 |
|
80 |
|
| 82 |
void* bt[1024]; |
81 |
void* bt[1024]; |
| 83 |
size_t btSize; |
82 |
size_t btSize; |
| 84 |
char** btSymbols; |
|
|
| 85 |
|
83 |
|
| 86 |
btSize = backtrace(bt, 1024); |
84 |
btSize = 0; |
| 87 |
btSymbols = backtrace_symbols(bt, btSize); |
|
|
| 88 |
|
85 |
|
| 89 |
#if defined(KERN_PROC_PATHNAME) |
86 |
#if defined(KERN_PROC_PATHNAME) |
| 90 |
int mib[] = { |
87 |
int mib[] = { |
|
Lines 112-118
void CrashReporter::createAndSaveCrash(int sig) {
Link Here
|
| 112 |
#endif |
109 |
#endif |
| 113 |
|
110 |
|
| 114 |
for (size_t i = 0; i < btSize; ++i) { |
111 |
for (size_t i = 0; i < btSize; ++i) { |
| 115 |
finalCrashReport += getFormat("\t#%lu | %s\n", i, btSymbols[i]); |
|
|
| 116 |
|
112 |
|
| 117 |
#ifdef __clang__ |
113 |
#ifdef __clang__ |
| 118 |
const auto CMD = getFormat("llvm-addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]); |
114 |
const auto CMD = getFormat("llvm-addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]); |
|
Lines 123-129
void CrashReporter::createAndSaveCrash(int sig) {
Link Here
|
| 123 |
finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2); |
119 |
finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2); |
| 124 |
} |
120 |
} |
| 125 |
|
121 |
|
| 126 |
free(btSymbols); |
|
|
| 127 |
|
122 |
|
| 128 |
finalCrashReport += "\n\nLog tail:\n"; |
123 |
finalCrashReport += "\n\nLog tail:\n"; |