EmbarkStudios / crash-handling

Collection of crates to deal with crashes
Apache License 2.0
138 stars 13 forks source link

Add `RtlCaptureContext` replacement #62

Closed Jake-Shadle closed 1 year ago

Jake-Shadle commented 1 year ago

This adds a replacement for RtlCaptureContext ported from Crashpad. The implementation is put here since this crate is used by both crash-handling in this repo, as well as minidump-writer, and unfortunately the bindings for both winapi and windows-sys are currently...broken. Neither of them properly align the CONTEXT structures on x86_64/aarch64, which can cause crashes and is just generally uhhh, not good. Since we already have replacments for getcontext on Linux it made sense to put it here. Additionally, unlike RtlCaptureContext, the x86_64 (though not aarch64) implementation captures floating point and vector state as well.