Created
April 20, 2012 03:36
-
-
Save luikore/2425703 to your computer and use it in GitHub Desktop.
Monkey patch debug.rb to make source listing command work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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