From: Seth Kurtzberg Date: 2003-02-26T17:29:36+09:00 Subject: Re: Debugger Not Working On Wednesday 26 February 2003 01:25 am, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Debugger Not Working" > > on 03/02/26, nobu.nokada@softhome.net writes: > |What about singleton methods? > > Currently, Class:Method catch *both* class method and instance method. > For other singlethon methods, object:method is available if simple > string representation is avalable, e.g. Except that there is a bug and currently Class:Method actually catches _neither_, not both. > > % ruby -r debug -e 'def self.foo; end; self.foo' > Debug.rb > Emacs support available. > > -e:1:def self.foo; end; self.foo > (rdb:1) b main:foo > Set breakpoint 1 at main:foo > (rdb:1) c > Breakpoint 1, foo at main:foo > -e:1:def self.foo; end; self.foo > (rdb:1) c > % > > With the attached patch, you can use new pattern: > > b object.method > > matz. > > > --- lib/debug.rb 25 Feb 2003 14:11:40 -0000 1.36 > +++ lib/debug.rb 26 Feb 2003 08:24:21 -0000 > @@ -160,6 +160,5 @@ class Context > 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 > @@ -299,2 +298,8 @@ class Context > > + 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+(?:(.+):)?(.+)$/ > @@ -711,3 +716,4 @@ EOHELP > 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 -- Seth Kurtzberg M. I. S. Corp. 480-661-1849 seth@cql.com