Skip to content

Commit 019fe85

Browse files
committed
clear removed breakpoints.
`setBreakpoints` requests specify a set of "enabled lines" in a specified path. In otherwords, if existing breakpoins in specified path are not in a set, they should be removed. fix #519 fix ruby/vscode-rdbg#17
1 parent 0feaffa commit 019fe85

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/debug/server_dap.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,10 @@ def process
217217
@is_attach = true
218218
when 'setBreakpoints'
219219
path = args.dig('source', 'path')
220-
bp_args = args['breakpoints']
220+
SESSION.clear_line_breakpoints path
221+
221222
bps = []
222-
bp_args.each{|bp|
223+
args['breakpoints'].each{|bp|
223224
line = bp['line']
224225
if cond = bp['condition']
225226
bps << SESSION.add_line_breakpoint(path, line, cond: cond)

lib/debug/session.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,14 @@ def add_line_breakpoint file, line, **kw
13701370
@ui.puts e.message
13711371
end
13721372

1373+
def clear_line_breakpoints file
1374+
@bps.delete_if do |k, bp|
1375+
if (Array === k) && DEBUGGER__.compare_path(k.first, file)
1376+
bp.delete
1377+
end
1378+
end
1379+
end
1380+
13731381
def add_iseq_breakpoint iseq, **kw
13741382
bp = ISeqBreakpoint.new(iseq, [:line], **kw)
13751383
add_bp bp

0 commit comments

Comments
 (0)