Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/common/crash_handler.h
4208 views
1
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <[email protected]>
2
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
3
4
#pragma once
5
6
#include <string_view>
7
8
#ifndef _WIN32
9
#include <signal.h>
10
#endif
11
12
namespace CrashHandler {
13
14
/// Adds a callback to run just before the crash handler exits.
15
/// It's not guaranteed that this handler will actually run, because the process state could be very messed up by this
16
/// point. It's mainly a thing so that we can free up the shared memory object if there was one created.
17
using CleanupHandler = void(*)();
18
19
bool Install(CleanupHandler cleanup_handler);
20
void SetWriteDirectory(std::string_view dump_directory);
21
void WriteDumpForCaller(std::string_view message);
22
23
#ifndef _WIN32
24
25
// Allow crash handler to be invoked from a signal.
26
void CrashSignalHandler(int signal, siginfo_t* siginfo, void* ctx);
27
28
#endif
29
30
} // namespace CrashHandler
31
32