36 |
ComponentManager.new(plugin, base_slot, Debugger, 1) |
ComponentManager.new(plugin, base_slot, Debugger, 1) |
37 |
|
|
38 |
# Create the Debug menu item and associate a command with it |
# Create the Debug menu item and associate a command with it |
39 |
|
# When the command is invoked create a new debugger session |
40 |
|
# unless there is one already and start it |
41 |
cmd_mgr = plugin['/system/ui/commands'].manager |
cmd_mgr = plugin['/system/ui/commands'].manager |
42 |
|
|
43 |
debugger = nil |
debugger = nil |
44 |
session = nil |
session = nil |
45 |
cmd = cmd_mgr.add("App/Run/Debugger", "&Debugger") do |cmd_slot| |
cmd = cmd_mgr.add("App/Run/Debugger", "&Debugger") do |cmd_slot| |
46 |
unless debugger |
if debugger |
47 |
|
if debugger.manager.running? |
48 |
|
debugger.manager.show |
49 |
|
else |
50 |
|
debugger.manager.start |
51 |
|
end |
52 |
|
else |
53 |
debugger = base_slot.manager.add |
debugger = base_slot.manager.add |
54 |
end |
end |
55 |
end |
end |
100 |
# |
# |
101 |
def initialize(plugin, base_slot) |
def initialize(plugin, base_slot) |
102 |
setup(plugin, base_slot) |
setup(plugin, base_slot) |
103 |
|
@plugin['/system/ui/current'].link('Debugger',base_slot) |
|
@loaded_files = Hash.new |
|
|
@running = false |
|
|
@breakpoints = Array.new |
|
|
@breakpoint_subscribers = Hash.new |
|
|
@action_queue = Array.new |
|
|
|
|
|
@plugin['/system/ui/current/Debugger'].data = self |
|
|
@plugin.log_info << "Debugger session created #{base_slot.path}" |
|
104 |
self.start |
self.start |
105 |
end |
@plugin.log_info << "Debugger session created #{base_slot.path}" |
106 |
|
end |
107 |
|
|
108 |
|
|
109 |
## |
## |
113 |
def start |
def start |
114 |
|
|
115 |
return unless @plugin['/system/ui/current/EditPane'].managed? |
return unless @plugin['/system/ui/current/EditPane'].managed? |
116 |
@actions['toggle'].invoke |
@actions['show'].invoke |
117 |
|
|
118 |
|
# initialize variables |
119 |
|
@loaded_files = Hash.new |
120 |
|
@running = false |
121 |
|
@breakpoints = Array.new |
122 |
|
@breakpoint_subscribers = Hash.new |
123 |
|
@action_queue = Array.new |
124 |
|
|
125 |
# open the debugger command pipe |
# open the debugger command pipe |
126 |
open_pipe() |
open_pipe() |
127 |
|
|
271 |
# |
# |
272 |
def close() |
def close() |
273 |
@actions['close'].invoke |
@actions['close'].invoke |
274 |
@plugin.log_info << "Debugger plugin closed #{@base_slot.path}" |
@plugin['/system/ui/current/Debugger'].unlink |
275 |
@active = nil |
@active = nil |
276 |
|
@plugin.log_info << "Debugger plugin closed #{@base_slot.path}" |
277 |
@base_slot.prune |
@base_slot.prune |
278 |
end |
end |
279 |
|
|
284 |
# |
# |
285 |
def show_debugline(file,line) |
def show_debugline(file,line) |
286 |
return if file.nil? |
return if file.nil? |
287 |
ep_slot = EditPane.open(file) |
ep_slot = @plugin['/plugins/rubyide_gui-editpane/actions/find_file'].invoke(file) |
288 |
ep_slot.manager.show_debugline(line) |
|
289 |
|
if ep_slot.nil? |
290 |
|
cmd_mgr = @plugin['/system/ui/commands'].manager |
291 |
|
ep_slot = cmd_mgr.command("App/File/Load").invoke(file) |
292 |
|
end |
293 |
|
ep_slot['actions/make_current'].invoke |
294 |
|
ep_slot['actions/show_debugline'].invoke(line) |
295 |
end |
end |
296 |
|
|
297 |
## |
## |
334 |
# |
# |
335 |
def set_all_breakpoints(file) |
def set_all_breakpoints(file) |
336 |
# Editpane properties keeps track of where the break points are placed |
# Editpane properties keeps track of where the break points are placed |
337 |
# from one FR session to another. See ask the edit pane for the breakpoints |
# from one FR session to another. So ask the edit pane for the breakpoints |
338 |
EditPane.breakpoints(file).each { |line| add_breakpoint(file,line) } |
lines = @plugin['/plugins/rubyide_gui-editpane/actions/breakpoints_for_file'].invoke(file) |
339 |
|
unless lines.nil? |
340 |
|
lines.each { |line| add_breakpoint(file,line) } |
341 |
|
end |
342 |
end |
end |
343 |
|
|
344 |
## |
## |
441 |
running |
running |
442 |
end |
end |
443 |
|
|
444 |
|
|
445 |
|
## |
446 |
|
# Show the debugger. Actually relay to the renderer |
447 |
|
# |
448 |
|
# Return:: none |
449 |
|
# |
450 |
|
def show |
451 |
|
@actions['show'].invoke |
452 |
|
end |
453 |
|
|
454 |
|
|
455 |
## |
## |
456 |
# send a command to the remote debugger |
# send a command to the remote debugger |
457 |
def send_command(cmd) |
def send_command(cmd) |