summaryrefslogtreecommitdiff
path: root/lib/debug.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-03 05:17:39 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-03 05:17:39 +0000
commit6a6d0ad22009c437217eb6aeb4c3750f7a3aaa6d (patch)
tree4ab0fd67ef12ea789ccb12df06654057f5ee6f87 /lib/debug.rb
parent0cd0eab641a16d6e59f424ab3f5fad3550fa54b5 (diff)
* 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
Diffstat (limited to 'lib/debug.rb')
-rw-r--r--lib/debug.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/debug.rb b/lib/debug.rb
index 74e06e0..8f2999a 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