// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <[email protected]>1// SPDX-License-Identifier: CC-BY-NC-ND-4.023#pragma once45#include <string_view>67#ifndef _WIN328#include <signal.h>9#endif1011namespace CrashHandler {1213/// Adds a callback to run just before the crash handler exits.14/// It's not guaranteed that this handler will actually run, because the process state could be very messed up by this15/// point. It's mainly a thing so that we can free up the shared memory object if there was one created.16using CleanupHandler = void(*)();1718bool Install(CleanupHandler cleanup_handler);19void SetWriteDirectory(std::string_view dump_directory);20void WriteDumpForCaller(std::string_view message);2122#ifndef _WIN322324// Allow crash handler to be invoked from a signal.25void CrashSignalHandler(int signal, siginfo_t* siginfo, void* ctx);2627#endif2829} // namespace CrashHandler303132