Crate external_unwind_info
source ·Expand description
Registers and stores unwind information from external components.
Typically, Theseus maintains metadata about all crates loaded and linked into system.
Unwind info is part of this (the .eh_frame
section data).
However, for other components compiled outside of Theseus and beyond it’s knowledge, we don’t necessarily have control over or access to those components’ section structure and miscellaneous internal information. Nevertheless, we still want to be able to handle their resource management properly by unwinding through their stack frames and running cleanup handlers as needed.
Hence, this crate allows those external components to register their own
unwind information as needed.
Currently, we use this crate to support wasmtime-jit
, which needs to
register unwinding information for JIT-compiled native code built from WASM binaries
and then deregister it when those JIT-ted modules are destroyed.
The API here is loosely similar to libunwind
’s two-part API:
__register_frame()
and __deregister_frame()
.
Because it must accept raw pointers to sections, all APIs are inherently unsafe.
Future TODOs
Currently, this crate unsafely assumes that the third party component that registers its unwind info will ensure that unwind info is valid for the full duration of it being registered.
In the future, ideally we would redesign this crate to offer a safer API that obtains shared ownership However, that would of course require modifying the dependent crates and redesigning them to utilize this safer API.
Structs
- Unwinding information for an external (non-Theseus) component.
Enums
- Errors that may occur when registering or [deregistering] external unwind info.
Functions
- Remove a previously-registered section of external unwinding information.
- Returns the registered external unwind information that covers the given address in its text section.
- Register a new section of external unwinding information.