-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor...a lot #13
Refactor...a lot #13
Conversation
There was a _ton_ of duplication of minidump types between this crate and minidump-common, so this refactors the code to remove basically all types that minidump-common already had, and changed the minidump_writer code to use scroll pwrite instead of relying on repr(C) and byte transmutes
Urgh, I messed up my tabs and posted my original answer to the wrong PR. Here it is: From a first 'quick' glance, I can say that its.... long :D Apart from that:
Let's pick this up on Monday again and have a great weekend! |
Yah, again, sorry about that, I'll split it out into smaller PRs that are easier to review/digest.
|
Thanks for your work! I guess we can close this one now? |
Yup! |
I'm opening this as a draft as my intention is to split this into multiple PRs tomorrow, I just wanted to post this to get any initial feedback and just generally spread awareness.
A little background, I had started doing my own reimplementation of Breakpad's signal handling and minidump writing before I was made aware that this crate existed, so I kind of stopped on the minidump writing part and folded this project into the code I had (see the PR EmbarkStudios/crash-handling#1), so most of the changes came about from using this crate in production code already, as it allows us to catch crashes when targeting musl, which was tedious due to all of the Breakpad C++ code.
The high level changes are basically:
crash_context::CrashContext
structure which allows the crash context to be easily shared between multiple crates, as one of the goals of this crate and the general effort around it with mozilla/sentry was to de-monolith the old breakpad structure.crash_context
defines its ownucontext_t
and friends rather than relying on libc's, as well as its owngetcontext
, as libc's has some rather unfortunate differences between libc implementations, most notably formusl
as eg.getcontext
has been deprecated for decades and has no replacement, but...is still useful for testing. Sincemusl
was my primary target initially, all this code means that this crate now works formusl
, resolving Doesn't build on x86_64 musl #4.scroll::Pwrite
derives for all of the relevant structures that this crates writes. rust-minidump/rust-minidump@d7a5a24minidump-writer
as I want to add Windows support next, and I assume Mac support as well will come, so having the crate named minidump_writer_linux felt too specific.#cfg
usage withcfg_if
as it reduces messy boilerplate and makes things easier to read.Things I probably shouldn't have changed:
mod.rs
files that made the codebase annoying to navigateThings I broke:
I haven't been compiling or testing on anything except x86/_64 so none of the arm/aarch64/mips code paths even compile right now, but I hope to address those tomorrow, or in follow up PRs.