Support functional setFunctionBreakpoints command#3
Open
st0012 wants to merge 3 commits intoruby-tooling:masterfrom
Open
Support functional setFunctionBreakpoints command#3st0012 wants to merge 3 commits intoruby-tooling:masterfrom
setFunctionBreakpoints command#3st0012 wants to merge 3 commits intoruby-tooling:masterfrom
Conversation
peterzhu2118
reviewed
Jul 5, 2022
|
|
||
| breakpoints = bps.map do |bp| | ||
| if bp["name"]&.match(Session::METHOD_SIGNATURE_REGEXP) | ||
| make_breakpoint [:method, $1, $2, $3, bp["condition"]] |
There was a problem hiding this comment.
bp["condition"] here could be the empty string if the user first creates a condition, then deletes the condition. We should treat an empty string like nil (i.e. no condition) instead of like a false condition, so we should turn the empty string into nil.
Comment on lines
+1346
to
+1350
| def add_method_breakpoint(method_signature) | ||
| if method_signature.match(METHOD_SIGNATURE_REGEXP) | ||
| @tc << [:breakpoint, :method, $1, $2, $3] | ||
| end | ||
| end |
| end | ||
| end | ||
|
|
||
| def test_set_function_breakpoints_sets_breakpoint_with_condition |
There was a problem hiding this comment.
This test doesn't really test when condition evaluates to true.
|
|
||
| def test_set_function_breakpoints_unsets_method_breakpoints | ||
| run_protocol_scenario PROGRAM, cdp: false do | ||
| res_set_function_breakpoints([{ name: "Foo::Bar.a" }]) |
There was a problem hiding this comment.
This breakpoint wouldn't have triggered anyways since it doesn't match anything in the code.
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.
Currently, DAP server responds to
setFunctionBreakpointscommand but it doesn't really do anything. This PR enables adding/removing method breakpoints.Supported breakpoint types:
Foo#foo- will stop atFoo's instance methodfooFoo.bar- will stop atFoo's singleton methodbarThis is not intentionally supported but currently it works:
foo.foo- will stop atfooobject's#foomethod callCondition is also supported:
Demos
Function Breakpoint
Function.breakpoints.mov
Function Breakpoint with Conditions
Function.breakpoints.with.condition.mov