duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

crash_handler.h (867B)


      1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR 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();
     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