Callback for breakpad. It is called by breakpad whenever a minidump file has been written and should not be called directly. It logs the event before breakpad crashes the process. Due to the process being in a failed state we write to stdout/stderr and let the surrounding redirection make sure the output gets logged. The calls might still fail in unknown scenarios as the process is in a broken sta
| 119 | /// still fail in unknown scenarios as the process is in a broken state. However we don't |
| 120 | /// rely on them as the minidump file has been written already. |
| 121 | bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, |
| 122 | bool succeeded) { |
| 123 | // See if a file was written successfully. |
| 124 | if (succeeded) { |
| 125 | // Write to stdout/stderr, which will usually be captured in the INFO/ERROR log. |
| 126 | ThreadDebugInfo* thread_info = GetThreadDebugInfo(); |
| 127 | if (thread_info != nullptr) { |
| 128 | write_dump_threadinfo(STDOUT_FILENO, thread_info); |
| 129 | write_dump_threadinfo(STDERR_FILENO, thread_info); |
| 130 | } else { |
| 131 | const char msg[] = "Minidump with no thread info available.\n"; |
| 132 | const int msg_len = sizeof(msg) / sizeof(msg[0]) - 1; |
| 133 | sys_write(STDOUT_FILENO, msg, msg_len); |
| 134 | sys_write(STDERR_FILENO, msg, msg_len); |
| 135 | } |
| 136 | |
| 137 | const char* path = descriptor.path(); |
| 138 | write_dump_path(STDOUT_FILENO, path); |
| 139 | write_dump_path(STDERR_FILENO, path); |
| 140 | } |
| 141 | // Return the value received in the call as described in the minidump documentation. If |
| 142 | // this values is true, then no other handlers will be called. Breakpad will still crash |
| 143 | // the process. |
| 144 | return succeeded; |
| 145 | } |
| 146 | |
| 147 | /// Signal handler to write a minidump file outside of crashes. |
| 148 | static void HandleSignal(int signum, siginfo_t* info, void* context) { |