Class: Byebug::DAP::Command::SetBreakpoints
- Inherits:
-
Byebug::DAP::Command
- Object
- Byebug::DAP::Command
- Byebug::DAP::Command::SetBreakpoints
- Defined in:
- lib/byebug/dap/commands/set_breakpoints.rb
Constant Summary
Constants inherited from Byebug::DAP::Command
Instance Method Summary collapse
Methods inherited from Byebug::DAP::Command
command, execute, #execute_on_thread, #initialize, #log, register!, resolve!, #safe_execute, #started!, #stopped!
Methods included from SafeHelpers
Constructor Details
This class inherits a constructor from Byebug::DAP::Command
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/byebug/dap/commands/set_breakpoints.rb', line 9 def execute return unless path = can_read_file!(args.source.path) if args.lines.empty? && args.breakpoints.empty? Byebug.breakpoints.reject! { |bp| bp.source == path } respond! body: { breakpoints: [] } return end existing = Byebug.breakpoints.filter { |bp| bp.source == path } verified = [] lines = potential_breakpoint_lines(path) { |e| respond! success: false, message: "Failed to resolve breakpoints for #{path}" return } (args.lines & lines).each do |l| find_or_add_breakpoint(verified, existing, path, l) end args.breakpoints.filter { |rq| lines.include?(rq.line) }.each do |rq| bp = find_or_add_breakpoint(verified, existing, path, rq.line) bp.expr = convert_breakpoint_condition(rq.condition) bp.hit_condition, bp.hit_value = convert_breakpoint_hit_condition(rq.hitCondition) @session.set_log_point(bp, rq.logMessage) end @session.clear_breakpoints(*existing) respond! body: { breakpoints: verified.map { |bp| { id: bp.id, line: bp.pos, verified: true, } } } end |