WIP: feat: WER integration#1837
Open
jpnurmi wants to merge 39 commits into
Open
Conversation
de2ad2d to
dac6b6c
Compare
This reverts commit 2d983e7 because it's annoyingly complicated and probably not needed.
75d0c15 to
c7fc095
Compare
Adds a sentry_integration_t struct with a register_func callback that is called from sentry_init() while the scope lock is held. Integrations can use this to create and register scope observers. sentry_options_add_integration() stores integrations in options, which takes ownership. An optional free_func is called before the integration struct is freed.
Adds sentry_integration_wer_new() which creates an integration that uses a scope observer to sync sentry scope state to Windows Error Reporting: - Tags are synced via WerRegisterCustomMetadata (loaded dynamically for compatibility with pre-19H1 Windows 10 builds). - File attachments are registered with WerRegisterFile. - Buffer attachments are registered with WerRegisterMemoryBlock. When tags or attachments are removed via the sentry API, the corresponding WER registrations are cleaned up.
Replace the generic sentry_integration_t approach with a simpler pattern matching the existing Qt integration (SENTRY_INTEGRATION_QT): - Remove sentry_integration_t, sentry_options_add_integration(), and all the dynamic array management in options. - Add a SENTRY_INTEGRATION_WER CMake option that conditionally compiles the WER integration source and sets the compile definition. - sentry_integration_setup_wer(scope, options) is called from sentry_init() inside SENTRY_WITH_SCOPE_MUT. - The WER integration uses static globals for wer.dll function pointers instead of a heap-allocated state struct.
The source file is already guarded with #ifdef SENTRY_PLATFORM_WINDOWS, so it quietly becomes a no-op on other platforms without needing a FATAL_ERROR.
48dffcf to
6b31a5c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6b31a5c. Configure here.
| const char *key, sentry_value_t UNUSED(value), void *data) | ||
| { | ||
| wer_remove_tag(data, key, strlen(key)); | ||
| } |
There was a problem hiding this comment.
Cleanup uses strlen on tag keys
Low Severity
wer_cleanup_tag passes strlen(key) into wer_remove_tag during shutdown cleanup, while tag set/remove paths use explicit key_len from sentry_set_tag_n / sentry_remove_tag_n. Keys stored with embedded NUL bytes can unregister under the wrong WER metadata name.
Reviewed by Cursor Bugbot for commit 6b31a5c. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


The WER (Windows Error Reporting) integration:
cmake -DSENTRY_INTEGRATION_WER=ON(inspired by the existing Qt integration)sentry_initsentry_scope_observer_t, also WIP)WerRegisterCustomMetadata/WerUnregisterCustomMetadata(Windows 10 1703+)WerRegisterFile/WerUnregisterFileWerRegisterMemoryBlock/WerUnregisterMemoryBlockThe implementation is backend-agnostic, but does not work with breakpad or crashpad, which prevent WER from handling the exception.