Pass debug messages on to someone else to handle - Windows specific #75
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.
Some Windows libraries use OutputDebugString() to log a message to a debugger. This works by throwing an exception and then a debugger being a registered exception handler. For example, th Google family of chromium-based APIs do this, including libwebrtc that is part of node-webrtc.
Unfortunately, node-segfault-handler intercepts these exceptions and reports them as SIGSEGV, printing a stack trace and marks them as handled by returning EXCEPTION_EXECUTE_HANDLER. In this case and implemented by this PR, it would be better to not handle the exception and pass it onto any other interested party with EXCEPTION_CONTINUE_SEARCH.
Also, as part of the debugging process, the code can try to set the thread name via exception. This PR also passes this exception onwards and upwards.