Debugger Not Working

All,

Using the Ruby debugger with 1.8, breakpoints are ignored. Breakpoints are
working with 1.6.x. Does anyone know what is causing this, and/or whether
anyone is working on fixing the problem?

···


Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.com

Hi,

···

In message “Debugger Not Working” on 03/02/25, Seth Kurtzberg seth@cql.com writes:

Using the Ruby debugger with 1.8, breakpoints are ignored. Breakpoints are
working with 1.6.x. Does anyone know what is causing this, and/or whether
anyone is working on fixing the problem?

Which 1.8? I remember 1.8.0-preview1 had that problem I already
fixed. Forget about preview1. That was just a landmark. Try the
latest HEAD from CVS.

						matz.

Hi, Seth,

From: Seth Kurtzberg [mailto:seth@cql.com]
Sent: Tuesday, February 25, 2003 1:08 AM

Using the Ruby debugger with 1.8, breakpoints are ignored.
Breakpoints are
working with 1.6.x. Does anyone know what is causing this,
and/or whether
anyone is working on fixing the problem?

Is your bp-problem like as follows?

nakahiro@RUBY ~/test
$ cat foo.rb
p 1
p 2

nakahiro@RUBY ~/test
$ ruby -rdebug foo.rb
Debug.rb
Emacs support available.

foo.rb:1:p 1
(rdb:1) break 2
Set breakpoint 1 at foo.rb:2
(rdb:1) cont
1
Breakpoint 1, toplevel at foo.rb:2
foo.rb:2:p 2
(rdb:1) finish
2

nakahiro@RUBY ~/test
$ ruby -rdebug …/test/foo.rb # Same file
Debug.rb
Emacs support available.

…/test/foo.rb:1:p 1
(rdb:1) break 2
Set breakpoint 1 at …/test/foo.rb:2
(rdb:1) cont
1
2 # !!! Should break before this line !!!

nakahiro@RUBY ~/test
$

I fixed it in CVS last night. Would you try it?

Regards,
// NaHi

CVS head has the same problem. I’ve installed head from last Friday. I
verified with several other 1.8 head users that they see the same problem.

···

On Monday 24 February 2003 09:45 am, Yukihiro Matsumoto wrote:

Hi,

In message “Debugger Not Working” > > on 03/02/25, Seth Kurtzberg seth@cql.com writes:

Using the Ruby debugger with 1.8, breakpoints are ignored. Breakpoints
are working with 1.6.x. Does anyone know what is causing this, and/or
whether anyone is working on fixing the problem?

Which 1.8? I remember 1.8.0-preview1 had that problem I already
fixed. Forget about preview1. That was just a landmark. Try the
latest HEAD from CVS.

  					matz.


Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.com

hello,

just wondering if i this is the best
solution to the stack limit problem in os x,
or if there is some other fix/patch to do the trick:

in eval.c … changing this line:

double space = (double)rlim.rlim_cur*0.2;

to this:

double space;
rlim.rlim_cur = rlim.rlim_max;
setrlimit(RLIMIT_STACK, &rlim);
space = (double)rlim.rlim_cur*0.2;

thanks much,
c

It is working now with line numbers. What is the syntax for breaking at a
method? That isn’t working but I may not be using the correct syntax.

···

On Tuesday 25 February 2003 06:36 pm, NAKAMURA, Hiroshi wrote:

Hi, Seth,

From: Seth Kurtzberg [mailto:seth@cql.com]
Sent: Tuesday, February 25, 2003 1:08 AM

Using the Ruby debugger with 1.8, breakpoints are ignored.
Breakpoints are
working with 1.6.x. Does anyone know what is causing this,
and/or whether
anyone is working on fixing the problem?

Is your bp-problem like as follows?

nakahiro@RUBY ~/test
$ cat foo.rb
p 1
p 2

nakahiro@RUBY ~/test
$ ruby -rdebug foo.rb
Debug.rb
Emacs support available.

foo.rb:1:p 1
(rdb:1) break 2
Set breakpoint 1 at foo.rb:2
(rdb:1) cont
1
Breakpoint 1, toplevel at foo.rb:2
foo.rb:2:p 2
(rdb:1) finish
2

nakahiro@RUBY ~/test
$ ruby -rdebug …/test/foo.rb # Same file
Debug.rb
Emacs support available.

…/test/foo.rb:1:p 1
(rdb:1) break 2
Set breakpoint 1 at …/test/foo.rb:2
(rdb:1) cont
1
2 # !!! Should break before this line !!!

nakahiro@RUBY ~/test
$

I fixed it in CVS last night. Would you try it?

Regards,
// NaHi


Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.com

Hi,

···

In message “Re: Debugger Not Working” on 03/02/25, Seth Kurtzberg seth@cql.com writes:

CVS head has the same problem. I’ve installed head from last Friday. I
verified with several other 1.8 head users that they see the same problem.

Oops, there must be something wrong left. Sorry.

						matz.

Hi, Seth,

From: Seth Kurtzberg [mailto:seth@cql.com]
Sent: Wednesday, February 26, 2003 12:40 PM

It is working now with line numbers. What is the syntax for
breaking at a method?

Does “(filename:)method_name” not work for you?

nakahiro@RUBY ~/test
$ cat foo.rb
def foo
bar
end

def bar
:bar
end

p foo

nakahiro@RUBY ~/test
$ ruby -rdebug foo.rb
Debug.rb
Emacs support available.

foo.rb:1:def foo
(rdb:1) break …/test/foo.rb:foo
Set breakpoint 1 at foo.rb:foo
(rdb:1) break bar
Set breakpoint 2 at foo.rb:bar
(rdb:1) cont
Breakpoint 1, foo at foo.rb:foo
foo.rb:1:def foo
(rdb:1) cont
Breakpoint 2, bar at foo.rb:bar
foo.rb:5:def bar
(rdb:1) finish
:bar

nakahiro@RUBY ~/test
$

Regards,
// NaHi

It may, I’ll try it, but it really doesn’t do much good even if it does work.
I was expecting something like ClassName::MethodName

For example, take this class structure:

class A
def methodName
.
.
end
end

class B < A
def methodName
.
.
end
end

How can a breakpoint be set at B::methodName?

···

On Tuesday 25 February 2003 11:04 pm, NAKAMURA, Hiroshi wrote:

Hi, Seth,

From: Seth Kurtzberg [mailto:seth@cql.com]
Sent: Wednesday, February 26, 2003 12:40 PM

It is working now with line numbers. What is the syntax for
breaking at a method?

Does “(filename:)method_name” not work for you?

nakahiro@RUBY ~/test
$ cat foo.rb
def foo
bar
end

def bar

:bar

end

p foo

nakahiro@RUBY ~/test
$ ruby -rdebug foo.rb
Debug.rb
Emacs support available.

foo.rb:1:def foo
(rdb:1) break …/test/foo.rb:foo
Set breakpoint 1 at foo.rb:foo
(rdb:1) break bar
Set breakpoint 2 at foo.rb:bar
(rdb:1) cont
Breakpoint 1, foo at foo.rb:foo
foo.rb:1:def foo
(rdb:1) cont
Breakpoint 2, bar at foo.rb:bar
foo.rb:5:def bar
(rdb:1) finish

:bar

nakahiro@RUBY ~/test
$

Regards,
// NaHi


Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.com

Hi, Seth,

From: Seth Kurtzberg [mailto:seth@cql.com]
Sent: Wednesday, February 26, 2003 4:06 PM

It may, I’ll try it, but it really doesn’t do much good even
if it does work.
I was expecting something like ClassName::MethodName

For example, take this class structure:

class A
def methodName
.
.
end
end

class B < A
def methodName
.
.
end
end

How can a breakpoint be set at B::methodName?

Unfortunately, you cannot set to B#method_name
explicitly for now. debug.rb does not check class name
of a traced method.

But I think it should have this feature. I’ll try to add
this till 1.8-preview2 (should be 2003-03-03).

Syntax?

break methodname
break lineno
break filename.methodname [New]
break filename:methodname
break filename:lineno
break at classname.methodname [New]
break at classname:lineno [New]

?

I always cannot remember which is “stop at” and “stop in”

with jdb debugging…

Regards,
// NaHi

Hi,

···

At Wed, 26 Feb 2003 16:34:58 +0900, NAKAMURA, Hiroshi nahi@keynauts.com wrote:

Syntax?

break methodname
break lineno
break filename.methodname [New]
break filename:methodname
break filename:lineno
break at classname.methodname [New]
break at classname:lineno [New]

What about singleton methods?


Nobu Nakada

Hi,

···

In message “Re: Debugger Not Working” on 03/02/26, “NAKAMURA, Hiroshi” nahi@keynauts.com writes:

I was expecting something like ClassName::MethodName

Unfortunately, you cannot set to B#method_name
explicitly for now. debug.rb does not check class name
of a traced method.

?? “b” command accepts classname:methodname from the beginning.

						matz.

“in” is usually the method name, “at” is a particular line. However, my
preference if possible is to just use “break” for both with the syntax
implying the breakpoint type.

For consistency, I would use ClassName::method_name, which matches other class
qualifiers such as ClassName::CONSTANT or similar structures. The other
alternative is, I guess, ClassName.method_name, but that might be confusing
as in other contexts that implies a static method.

···

On Wednesday 26 February 2003 12:34 am, NAKAMURA, Hiroshi wrote:

Hi, Seth,

From: Seth Kurtzberg [mailto:seth@cql.com]
Sent: Wednesday, February 26, 2003 4:06 PM

It may, I’ll try it, but it really doesn’t do much good even
if it does work.
I was expecting something like ClassName::MethodName

For example, take this class structure:

class A
def methodName
.
.
end
end

class B < A
def methodName
.
.
end
end

How can a breakpoint be set at B::methodName?

Unfortunately, you cannot set to B#method_name
explicitly for now. debug.rb does not check class name
of a traced method.

But I think it should have this feature. I’ll try to add
this till 1.8-preview2 (should be 2003-03-03).

Syntax?

break methodname
break lineno
break filename.methodname [New]
break filename:methodname
break filename:lineno
break at classname.methodname [New]
break at classname:lineno [New]

?

I always cannot remember which is “stop at” and “stop in”

with jdb debugging…

Regards,
// NaHi


Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.com

Hi, matz,

From: Yukihiro Matsumoto [mailto:matz@ruby-lang.org]
Sent: Wednesday, February 26, 2003 4:52 PM

I was expecting something like ClassName::MethodName

Unfortunately, you cannot set to B#method_name
explicitly for now. debug.rb does not check class name
of a traced method.

?? “b” command accepts classname:methodname from the beginning.

Sure. I slipped over the line “check_break_points” from
‘call’ event. (and I’ve never used the feature.)

‘file = File.basename($1 || file)’ is misleading…

Regards,
// NaHi

···

In message “Re: Debugger Not Working” > on 03/02/26, “NAKAMURA, Hiroshi” nahi@keynauts.com writes:

Hi, Nakada-san,

From: nobu.nokada@softhome.net [mailto:nobu.nokada@softhome.net]
Sent: Wednesday, February 26, 2003 4:47 PM

Syntax?

break methodname
break lineno
break filename.methodname [New]
break filename:methodname
break filename:lineno
break at classname.methodname [New]
break at classname:lineno [New]

What about singleton methods?

Yeah, Ruby is not like Java…

But under current ruby’s trace API that debug.rb uses,
we cannot distinguish singleton method from instance
method, right?

Regards,
// NaHi

···

At Wed, 26 Feb 2003 16:34:58 +0900, > NAKAMURA, Hiroshi nahi@keynauts.com wrote:

Hi,

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.

% 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
    
···

In message “Re: Debugger Not Working” on 03/02/26, nobu.nokada@softhome.net nobu.nokada@softhome.net writes:
+
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

It accepts it. But nothing happens (that is, it doesn’t actually set a
breakpoint at the desired location). With 1.8, at least.

···

On Wednesday 26 February 2003 12:51 am, Yukihiro Matsumoto wrote:

Hi,

In message “Re: Debugger Not Working” > > on 03/02/26, “NAKAMURA, Hiroshi” nahi@keynauts.com writes:

I was expecting something like ClassName::MethodName

Unfortunately, you cannot set to B#method_name
explicitly for now. debug.rb does not check class name
of a traced method.

?? “b” command accepts classname:methodname from the beginning.

  					matz.


Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.com

Hi,

···

In message “Re: Debugger Not Working” on 03/02/26, “NAKAMURA, Hiroshi” nahi@keynauts.com writes:

But under current ruby’s trace API that debug.rb uses,
we cannot distinguish singleton method from instance
method, right?

Right.

						matz.

Hi,

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.

···

On Wednesday 26 February 2003 01:25 am, Yukihiro Matsumoto wrote:

In message “Re: Debugger Not Working” > > on 03/02/26, nobu.nokada@softhome.net nobu.nokada@softhome.net writes:

% 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

Hi,

From: Seth Kurtzberg [mailto:seth@cql.com]
Sent: Wednesday, February 26, 2003 5:26 PM

It accepts it. But nothing happens (that is, it doesn’t
actually set a
breakpoint at the desired location). With 1.8, at least.

nakahiro@RUBY ~/test
$ cat foo.rb
module Foo
class Bar
def self.baz; end
end
end

Foo::Bar.baz

nakahiro@RUBY ~/test
$ ruby -rdebug foo.rb
Debug.rb
Emacs support available.

foo.rb:1:module Foo
(rdb:1) break Foo::Bar:baz
Set breakpoint 1 at Foo::Bar:baz
(rdb:1) cont
Breakpoint 1, baz at Foo::Bar:baz
foo.rb:3: def self.baz; end
(rdb:1) finish

nakahiro@RUBY ~/test
$

You may be setting bp with ‘Bar:baz’, not ‘Foo::Bar:baz’?

Regards,
// NaHi