Skip to content
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

First pass implementation #1

Merged
merged 61 commits into from Mar 15, 2022
Merged

First pass implementation #1

merged 61 commits into from Mar 15, 2022

Conversation

Jake-Shadle
Copy link
Member

@Jake-Shadle Jake-Shadle commented Feb 18, 2022

This is a first pass implementation of the core components in this repository. This pass only addresses x86_64-linux targets at the moment since that was easiest to test.

  • exception-handler - Heavily based off of breakpad's linux signal handler, this wraps up all of the gnarly signal handling code and calls a user provided callback with the signal details
  • crash-context - Shared crate that defines the context of a crash on a per-target basis, so that different crates can be orchestrated (eg exception-handler creates it, minidumper passes it over IPC, minidump-writer uses it to write minidump information)
    • Unix signal handlers use a ucontext_t as part of the signal info to relay state about place and state of the thread where a signal was raised. Unfortunately this was deprecated in POSIX...but there is no replacement AFAIK. This is a problem since libc doesn't support ucontext_t fully for musl, because it's deprecated, but when using the ucontext_t to get information for crash dumps, several fields need to be accessed that aren't present in the libc version, so instead of try and get this working (and stay working) I just made our own small version based off of libunwind, as the structure is really just arch specific, and we need to be able to pass it from an initial signal handler all the way to a crash dumper
  • minidumper - This implements a simple IPC client/server where the client is meant to be run in a process that wants to monitor for crashes, and the server, which is responsible for handling minidump requests from the client and creating a minidump similar to how breakpad works. The linux implementation for the crash dump creation was already implemented in https://github.com/msirringhaus/minidump_writer_linux, thus just uses a fork that changes it to use the crash context from the exception handler so that we don't have any messy unsafe or bit twiddling shenanigans

There are also 2 crates purely for exercising these other implementation crates. I'm rather proud of the naming for sadness-generator.

Copy link

@msirringhaus msirringhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Urgh, sorry I confused my tabs. Ignore this comment.

@Jake-Shadle Jake-Shadle merged commit 6fd9a44 into main Mar 15, 2022
@mergify mergify bot deleted the impl branch March 15, 2022 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants