100 |
# |
# |
101 |
def initialize(plugin, base_slot) |
def initialize(plugin, base_slot) |
102 |
setup(plugin, base_slot) |
setup(plugin, base_slot) |
103 |
|
@cmd_mgr = plugin["/system/ui/commands"].manager |
104 |
@plugin['/system/ui/current'].link('Debugger',base_slot) |
@plugin['/system/ui/current'].link('Debugger',base_slot) |
105 |
self.start |
self.start |
106 |
@plugin.log_info << "Debugger session created #{base_slot.path}" |
@plugin.log_info << "Debugger session created #{base_slot.path}" |
285 |
# |
# |
286 |
def show_debugline(file,line) |
def show_debugline(file,line) |
287 |
return if file.nil? |
return if file.nil? |
288 |
ep_slot = @plugin['/plugins/rubyide_gui-editpane/actions/find_file'].invoke(file) |
ep_slot = @cmd_mgr.command("EditPane/FindFile").invoke(file) |
289 |
|
# ep_slot = @plugin['/plugins/rubyide_gui-editpane/actions/find_file'].invoke(file) |
290 |
|
|
291 |
if ep_slot.nil? |
if ep_slot.nil? |
292 |
cmd_mgr = @plugin['/system/ui/commands'].manager |
ep_slot = @cmd_mgr.command("App/File/Load").invoke(file) |
|
ep_slot = cmd_mgr.command("App/File/Load").invoke(file) |
|
293 |
end |
end |
294 |
ep_slot['actions/make_current'].invoke |
ep_slot['actions/make_current'].invoke |
295 |
ep_slot['actions/show_debugline'].invoke(line) |
ep_slot['actions/show_debugline'].invoke(line) |
296 |
end |
end |
297 |
|
|
298 |
## |
## |
299 |
|
# Clear the highlighted line the debugger is currently pointing |
300 |
|
# |
301 |
|
def clear_debugline(file) |
302 |
|
show_debugline(file,nil) |
303 |
|
end |
304 |
|
|
305 |
|
## |
306 |
# Return the line number (starting at 1) the cursor is on |
# Return the line number (starting at 1) the cursor is on |
307 |
# in the current edit pane |
# in the current edit pane |
308 |
# |
# |
309 |
def cursor_line() |
def cursor_line() |
310 |
ep = @plugin['/system/ui/current/EditPane'].data |
ep_slot = @plugin['/system/ui/current/EditPane'] |
311 |
line = ep.cursor_line() |
line = ep_slot['actions/get_cursor_line'].invoke |
312 |
return line |
return line |
313 |
end |
end |
314 |
|
|
343 |
def set_all_breakpoints(file) |
def set_all_breakpoints(file) |
344 |
# Editpane properties keeps track of where the break points are placed |
# Editpane properties keeps track of where the break points are placed |
345 |
# from one FR session to another. So ask the edit pane for the breakpoints |
# from one FR session to another. So ask the edit pane for the breakpoints |
346 |
lines = @plugin['/plugins/rubyide_gui-editpane/actions/breakpoints_for_file'].invoke(file) |
lines = @cmd_mgr.command('EditPane/GetBreakpointsForFile').invoke(file) |
347 |
unless lines.nil? |
unless lines.nil? |
348 |
lines.each { |line| add_breakpoint(file,line) } |
lines.each { |line| add_breakpoint(file,line) } |
349 |
end |
end |
399 |
def run_to_cursor |
def run_to_cursor |
400 |
line = cursor_line() |
line = cursor_line() |
401 |
return if line == @line |
return if line == @line |
402 |
ep = @plugin['/system/ui/current/EditPane'].data |
file = @plugin['/system/ui/current/EditPane'].data |
|
file = ep.slot.data |
|
403 |
add_breakpoint(file, line, true) |
add_breakpoint(file, line, true) |
404 |
send_command('cont') |
send_command('cont') |
405 |
end |
end |
507 |
def printf( *args ) |
def printf( *args ) |
508 |
stg = sprintf( *args ) |
stg = sprintf( *args ) |
509 |
if ( (stg =~ /(.*):(\d+):/) != nil) |
if ( (stg =~ /(.*):(\d+):/) != nil) |
510 |
|
prev_file = @file |
511 |
@file = $1 |
@file = $1 |
512 |
@line = $2.to_i |
@line = $2.to_i |
513 |
puts "File: #{@file}, line: #{@line}" if DEBUG |
puts "File: #{@file}, line: #{@line}" if DEBUG |
514 |
|
|
515 |
|
clear_debugline(prev_file) unless prev_file == @file |
516 |
show_debugline(@file, @line) |
show_debugline(@file, @line) |
517 |
|
|
518 |
# first time we are stopping in this file? Then keep track of it |
# first time we are stopping in this file? Then keep track of it |
618 |
Thread.pass |
Thread.pass |
619 |
end |
end |
620 |
stop() |
stop() |
621 |
close() if @action == 'close' |
close() if @action == 'CLOSE' |
622 |
# do this last because it kills the thread it runs in!! |
# do this last because it kills the thread it runs in!! |
623 |
@debugSvr.stop_service |
@debugSvr.stop_service |
624 |
end |
end |