Skip to content

Instantly share code, notes, and snippets.

@luikore
Created April 20, 2012 03:36
Show Gist options
  • Save luikore/2425703 to your computer and use it in GitHub Desktop.
Save luikore/2425703 to your computer and use it in GitHub Desktop.
Monkey patch debug.rb to make source listing command work
class DEBUGGER__
def Context
def display_list(b, e, file, line)
stdout.printf "[%d, %d] in %s\n", b, e, file
lines = SCRIPT_LINES__[file]
if !lines
lines = File.readlines file rescue nil
end
if lines and lines != true
b.upto(e) do |n|
if n > 0 && lines[n-1]
if n == line
stdout.printf "=> %d %s\n", n, lines[n-1].chomp
else
stdout.printf " %d %s\n", n, lines[n-1].chomp
end
end
end
else
stdout.printf "No sourcefile available for %s\n", file
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment