-
Notifications
You must be signed in to change notification settings - Fork 24
Merge PtraceDumper and MinidumpWriter #155
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
Merge PtraceDumper and MinidumpWriter #155
Conversation
|
Needless to say, this is a breaking change in the API (albeit not a huge one) |
Reorganizes a bunch of code and also updates some things to use emerging Rust
best-practices.
- Change use statements to use blocks
- Prefer to use `super::` rather than `crate::` where applicable
- Use mod.rs in a directory instead of <modname>.rs when a module has
submodules
- Move error type definitions closer to where they are used
- Most error types are pretty specific to a tight scope, so put them there
- Exception is the MinidumpWriter's error type - There's so much code that
it's better to put it in its own module
- Merge PtraceDumper and MinidumpWriter
- The split between them has been blurry for a while
- Merge them and their error types together
- A nice thing about the split was that `MinidumpWriter` had a bit of a
"builder config" behavior for `PtraceDumper`. Let's keep that!
- There is now a `MinidumpWriterConfig` that is explicitly a fluent API used
to configure `MinidumperWriter`
- Change functions that were tightly coupled to `MinidumpWriter` to just be
impls on it
- Update tests to accept new structure
Fixes rust-minidump#154
21bb451 to
c35af12
Compare
gabrielesvelto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking very good, I think it makes the overall structure easier to follow and sheds some legacy we had inherited from Breakpad and didn't make sense anymore in the current code. However I'd like to hear @Jake-Shadle 's opinion on this given it's a breaking change in terms of API.
| } else { | ||
| Err(DumperError::PtraceDetachError(child, e)) | ||
| impl MinidumpWriterConfig { | ||
| pub fn new(process_id: Pid, blamed_thread: Pid) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought for the future: we do this in pretty much all our crates but we should really have a separate Tid types for threads. Obviously something for a follow-up.
Jake-Shadle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me.
|
Thanks @Jake-Shadle! I'm merging it |
Merges PtraceDumper and MinidumpWriter
While I'm at it, also reorganize a bunch of code and update some things to use emerging Rust best-practices.
super::rather thancrate::where applicableMinidumpWriterhad a bit of a "builder config" behavior forPtraceDumper. Let's keep that!MinidumpWriterConfigthat is explicitly a fluent API used to configureMinidumperWriterMinidumpWriterto just be impls on itFixes #154