File tree Expand file tree Collapse file tree 3 files changed +35
-17
lines changed Expand file tree Collapse file tree 3 files changed +35
-17
lines changed Original file line number Diff line number Diff line change @@ -316,9 +316,30 @@ Sends request to rdbg to add a breakpoint.
316316
317317Sends request to rdbg to delete a breakpoint.
318318
319- - req_set_exception_breakpoints
319+ - req_set_exception_breakpoints(breakpoints)
320320
321- Sends request to rdbg to set exception breakpoints.
321+ Sends request to rdbg to set exception breakpoints. e.g.
322+
323+ ``` rb
324+ req_set_exception_breakpoints([{ name: " RuntimeError" , condition: " a == 1" }])
325+ ```
326+
327+ Please note that ` setExceptionBreakpoints ` resets all exception breakpoints in every request.
328+
329+ So the following code will only set breakpoint for ` Exception ` .
330+
331+ ``` rb
332+ req_set_exception_breakpoints([{ name: " RuntimeError" }])
333+ req_set_exception_breakpoints([{ name: " Exception" }])
334+ ```
335+
336+ This means you can also use
337+
338+ ``` rb
339+ req_set_exception_breakpoints([])
340+ ```
341+
342+ to clear all exception breakpoints.
322343
323344- req_continue
324345
Original file line number Diff line number Diff line change @@ -13,32 +13,31 @@ class CatchTest < TestCase
1313 6| foo
1414 RUBY
1515
16- def test_catch_stops_when_the_runtime_error_raised
16+ def test_set_exception_breakpoints_sets_exception_breakpoints
1717 run_protocol_scenario PROGRAM do
18- req_set_exception_breakpoints
18+ req_set_exception_breakpoints ( [ { name : "RuntimeError" } ] )
1919 req_continue
2020 assert_line_num 3
2121 req_terminate_debuggee
2222 end
2323 end
2424
25- def test_set_exception_breakpoints_unset_exception_breakpoints
25+ def test_set_exception_breakpoints_unsets_exception_breakpoints
2626 run_protocol_scenario PROGRAM , cdp : false do
27- req_set_exception_breakpoints
28- req_set_exception_breakpoints ( exception : nil )
27+ req_set_exception_breakpoints ( [ { name : "RuntimeError" } ] )
28+ req_set_exception_breakpoints ( [ ] )
2929 req_continue
3030 end
3131 end
3232
3333 def test_set_exception_breakpoints_accepts_condition
3434 run_protocol_scenario PROGRAM , cdp : false do
35- req_set_exception_breakpoints ( condition : "a == 2" )
35+ req_set_exception_breakpoints ( [ { name : "RuntimeError" , condition : "a == 2" } ] )
3636 req_continue
37- # exits directly because of error
3837 end
3938
4039 run_protocol_scenario PROGRAM , cdp : false do
41- req_set_exception_breakpoints ( condition : "a == 1" )
40+ req_set_exception_breakpoints ( [ { name : "RuntimeError" , condition : "a == 1" } ] )
4241 req_continue
4342 assert_line_num 3
4443 req_terminate_debuggee
Original file line number Diff line number Diff line change @@ -125,15 +125,13 @@ def req_finish
125125 end
126126 end
127127
128- def req_set_exception_breakpoints ( exception : "RuntimeError" , condition : nil )
128+ def req_set_exception_breakpoints ( breakpoints )
129129 case ENV [ 'RUBY_DEBUG_TEST_UI' ]
130130 when 'vscode'
131- filter_options = [ ]
132-
133- if exception
134- filter_option = { filterId : exception }
135- filter_option [ :condition ] = condition if condition
136- filter_options << filter_option
131+ filter_options = breakpoints . map do |bp |
132+ filter_option = { filterId : bp [ :name ] }
133+ filter_option [ :condition ] = bp [ :condition ] if bp [ :condition ]
134+ filter_option
137135 end
138136
139137 send_dap_request 'setExceptionBreakpoints' , filters : [ ] , filterOptions : filter_options
You can’t perform that action at this time.
0 commit comments