breakpad_sys/
lib.rs

1#[repr(C)]
2pub struct ExceptionHandler {
3    _unused: [u8; 0],
4}
5
6#[cfg(not(windows))]
7pub type PathChar = u8;
8#[cfg(windows)]
9pub type PathChar = u16;
10
11pub type CrashCallback = extern "C" fn(
12    minidump_path: *const PathChar,
13    minidump_path_len: usize,
14    ctx: *mut std::ffi::c_void,
15);
16
17pub const INSTALL_NO_HANDLER: u32 = 0x0;
18pub const INSTALL_EXCEPTION_HANDLER: u32 = 0x1;
19pub const INSTALL_SIGNAL_HANDLER: u32 = 0x2;
20pub const INSTALL_BOTH_HANDLERS: u32 = INSTALL_EXCEPTION_HANDLER | INSTALL_SIGNAL_HANDLER;
21
22extern "C" {
23    /// Creates and attaches an exception handler that will monitor this process
24    /// for crashes
25    ///
26    /// Note: The `install_options` only applies on MacOS/iOS, it is ignored
27    /// for all other platforms.
28    pub fn attach_exception_handler(
29        path: *const PathChar,
30        path_len: usize,
31        crash_callback: CrashCallback,
32        crash_callback_ctx: *mut std::ffi::c_void,
33        install_options: u32,
34    ) -> *mut ExceptionHandler;
35
36    /// Detaches and frees the exception handler
37    pub fn detach_exception_handler(handler: *mut ExceptionHandler);
38}