From 6a6d0ad22009c437217eb6aeb4c3750f7a3aaa6d Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 3 Mar 2003 05:17:39 +0000 Subject: * parse.y (arg): parse 'lhs = a rescue b' as 'lhs=(a rescue b)'. * io.c (rb_io_fread): should not clearerr() if there's no filled buffer (i.e. rb_io_fread() returning zero). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/debug.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lib/debug.rb') diff --git a/lib/debug.rb b/lib/debug.rb index 74e06e010c..8f2999a3ab 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -158,10 +158,9 @@ class Context def debug_eval(str, binding) begin val = eval(str, binding) - val - rescue StandardError, ScriptError - at = eval("caller(0)", binding) - stdout.printf "%s:%s\n", at.shift, $!.to_s.sub(/\(eval\):1:(in `.*?':)?/, '') #` + rescue StandardError, ScriptError => e + at = eval("caller(1)", binding) + stdout.printf "%s:%s\n", at.shift, e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '') for i in at stdout.printf "\tfrom %s\n", i end @@ -297,6 +296,12 @@ class Context stdout.print "Trace off.\n" end + when /^\s*b(?:reak)?\s+(.+)[#.](.+)$/ + pos = $2.intern.id2name + file = debug_eval($1, binding) + break_points.push [true, 0, file, pos] + stdout.printf "Set breakpoint %d at %s.%s\n", break_points.size, file, pos + when /^\s*b(?:reak)?\s+(?:(.+):)?(.+)$/ pos = $2 file = File.basename($1 || file) @@ -646,7 +651,7 @@ EOHELP def check_break_points(file, pos, binding, id) return false if break_points.empty? - file = File.basename(file) +# file = File.basename(file) n = 1 for b in break_points if b[0] @@ -709,7 +714,8 @@ EOHELP when 'call' @frames.unshift [binding, file, line, id] if check_break_points(file, id.id2name, binding, id) or - check_break_points(klass.to_s, id.id2name, binding, id) + check_break_points(klass.to_s, id.id2name, binding, id) or + check_break_points(klass, id.id2name, binding, id) suspend_all debug_command(file, line, id, binding) end -- cgit v1.2.3