Skip to main content

Module backtrace

Module backtrace 

Source
Expand description

Configurable panic hook for miniextendr-based R packages.

The hook is process-global (std::panic::set_hook writes to a process slot), but its closure lives in the DLL’s code. If the package is unloaded (e.g. library.dynam.unload / dyn.unload) without removing the hook, the next panic anywhere in the process jumps to unmapped memory and tears down the SEH state on Windows — surfacing as “failed to initiate panic, error 5” in the next DLL that tries to unwind (#277).

miniextendr_panic_hook() installs; miniextendr_panic_hook_uninstall() takes it back off. Both are idempotent and paired by the init / unload code in worker.rs.

Constants§

LAST_PANIC_LOCATION 🔒
Source location of the most recent panic on this thread, captured by the panic hook. Location borrows the PanicHookInfo, so we snapshot an owned (file, line).

Statics§

INSTALLED 🔒
True iff this DLL instance has installed the panic hook.

Functions§

miniextendr_panic_hook
Register the miniextendr panic hook.
miniextendr_panic_hook_uninstall 🔒
Remove the miniextendr panic hook and revert to Rust’s default.
record_panic_location 🔒
Record a panic’s source location into the current thread’s take-once slot.
take_last_panic_location 🔒
Take (read + clear) the last panic location recorded on the current thread.