mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
0cd0eab641
commit
6a6d0ad220
7 changed files with 62 additions and 46 deletions
18
lib/debug.rb
18
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue