| 1 |
module RubyAMP |
| 2 |
class RemoteDebugger |
| 3 |
class BreakpointCommander < CommanderBase |
| 4 |
def list |
| 5 |
base.evaluate("Debugger.breakpoints.map{|b| {:id => b.id, :source => b.source, :line => b.pos} }", :control).map do |bp_options| |
| 6 |
Breakpoint.new(base, self, bp_options) |
| 7 |
end |
| 8 |
end |
| 9 |
|
| 10 |
def delete_all |
| 11 |
base.evaluate <<-EOF, :control |
| 12 |
breakpoint_ids = Debugger.breakpoints.map { |b| b.id } |
| 13 |
begin |
| 14 |
breakpoint_ids.each { |b_id| Debugger.remove_breakpoint(b_id) } |
| 15 |
breakpoint_ids.length |
| 16 |
rescue |
| 17 |
0 |
| 18 |
end |
| 19 |
EOF |
| 20 |
end |
| 21 |
|
| 22 |
def add(source, line) |
| 23 |
base.evaluate <<-EOF, :control |
| 24 |
bp = Debugger.add_breakpoint #{ENV['TM_FILEPATH'].to_s.inspect}, #{ENV['TM_LINE_NUMBER']} |
| 25 |
bp ? true : false |
| 26 |
EOF |
| 27 |
end |
| 28 |
end |
| 29 |
|
| 30 |
class Breakpoint |
| 31 |
attr_accessor :source, :line, :id |
| 32 |
|
| 33 |
def initialize(base, parent, options = {}) |
| 34 |
self.id = options[:id] |
| 35 |
self.source = options[:source] |
| 36 |
self.line = options[:line] |
| 37 |
end |
| 38 |
end |
| 39 |
end |
| 40 |
end |