Support DAP exceptionOptions for catching arbitrary exception classes - #1183
Open
rira100000000 wants to merge 1 commit into
Open
Support DAP exceptionOptions for catching arbitrary exception classes#1183rira100000000 wants to merge 1 commit into
rira100000000 wants to merge 1 commit into
Conversation
The console UI can catch arbitrary exception classes (catch MyError), but the DAP implementation only exposed two fixed filters: 'any' (Exception) and 'RuntimeError'. Filter conditions are evaluated in the binding of the raise site and cannot access the raised exception, so they are no substitute for class filtering either. Implement the DAP standard exceptionOptions argument of setExceptionBreakpoints (capability: supportsExceptionOptions), which was already listed under "Will be supported". Class names given via ExceptionPathSegment are registered as catch breakpoints using the same ancestor class-name matching as the console catch command, so subclasses are caught as well. - breakMode 'never' registers nothing. The others all break at raise, since Ruby's catch breakpoints fire when an exception is raised and DAP provides no way for an adapter to tell the client which breakModes it supports. - negate path segments are not supported for now and are reported as unverified. - Class names registered via exceptionOptions are remembered so that the next setExceptionBreakpoints request replaces them, as the DAP spec requires.
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.
Description
Fixes #1182
The console UI can catch arbitrary exception classes (catch MyError),
but the DAP implementation only exposed two fixed filters: 'any'
(Exception) and 'RuntimeError'. Filter conditions are evaluated in the
binding of the raise site and cannot access the raised exception, so
they are no substitute for class filtering either.
Implement the DAP standard exceptionOptions argument of
setExceptionBreakpoints (capability: supportsExceptionOptions), which
was already listed under "Will be supported". Class names given via
ExceptionPathSegment are registered as catch breakpoints using the
same ancestor class-name matching as the console catch command, so
subclasses are caught as well.
since Ruby's catch breakpoints fire when an exception is raised and
DAP provides no way for an adapter to tell the client which
breakModes it supports.
unverified.
the next setExceptionBreakpoints request replaces them, as the DAP
spec requires.
Example
This request makes the debuggee stop where
MyError(or a subclass of it) is raised:{ "command": "setExceptionBreakpoints", "arguments": { "filters": [], "exceptionOptions": [ { "path": [{ "names": ["MyError"] }], "breakMode": "always" } ] } }Tests
Added protocol tests in test/protocol/catch_test.rb:
I also verified the behavior manually by sending raw DAP requests to rdbg --open over a UNIX domain socket.