Class: Byebug::DAP::Command::SetFunctionBreakpoints
- Inherits:
-
Byebug::DAP::Command
- Object
- Byebug::DAP::Command
- Byebug::DAP::Command::SetFunctionBreakpoints
- Defined in:
- lib/byebug/dap/commands/set_function_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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/byebug/dap/commands/set_function_breakpoints.rb', line 9 def execute ::Byebug.breakpoints.each { |bp| ::Byebug::Breakpoint.remove(bp.id) if bp.pos.is_a?(String) } existing = Byebug.breakpoints.filter { |bp| bp.pos.is_a?(String) } verified = [] results = [] args.breakpoints.each do |rq| m = /^(?<class>[:\w]+)(?<sep>\.|#)(?<method>\w+)$/.match(rq.name) unless m results << { verified: false, message: "'#{rq.name}' is not a valid method identifier", } next end bp = find_or_add_breakpoint(verified, existing, m[:class], m[:method]) bp.expr = convert_breakpoint_condition(rq.condition) bp.hit_condition, bp.hit_value = convert_breakpoint_hit_condition(rq.hitCondition) end verified.each do |bp| cm, im = resolve_method(bp.source, bp.pos) if cm.nil? && im.nil? results << { id: bp.id, verified: true } end unless cm.nil? results << { id: bp.id, verified: true, source: Protocol::Source.new(name: File.basename(cm[0]), path: cm[0]), line: cm[1] } end unless im.nil? results << { id: bp.id, verified: true, source: Protocol::Source.new(name: File.basename(im[0]), path: im[0]), line: im[1] } end end @session.clear_breakpoints(*existing) respond! body: { breakpoints: results } end |