Ruby breakpoint has weird idea of what local_variables are?

R

RichardOnRails

Hi,

I've got a 7-liner:
require 'rubygems'
require 'breakpoint'

a = 'aaa'
b = 'bbb'
breakpoint
c = 'ccc'

In a Command window, I've got:
K:\_Projects\Ruby\_Ruby_Tests\TestBreakpoint>ruby TestBreakpoint.rb
Executing break point at TestBreakpoint.rb:9
irb(main):001:0> local_variables
=> ["id", "block", "_"]
irb(main):002:0> quit

This test is based on Recipe 17.10 of the Ruby Cookbook, O'Reilly,
2006

Why doesn't the array allegedly presenting local variables:
1. Include a, b & c?
2. Present the things it does; what do they signify?

I'm running Ruby 1.8.6 over WinXP-Pro/SP3

Thanks in Advance
Richard
 
R

Robert Klemme

2010/5/31 RichardOnRails said:
Hi,

I've got a 7-liner:
require 'rubygems'
require 'breakpoint'

a = 'aaa'
b = 'bbb'
breakpoint
c = 'ccc'

In a Command window, I've got:
K:\_Projects\Ruby\_Ruby_Tests\TestBreakpoint>ruby TestBreakpoint.rb
Executing break point at TestBreakpoint.rb:9
irb(main):001:0> local_variables
=> ["id", "block", "_"]
irb(main):002:0> quit

This test is based on Recipe 17.10 of the Ruby Cookbook, O'Reilly,
2006

Why doesn't the array allegedly presenting local variables:
1. Include a, b & c?
2. Present the things it does; what do they signify?

I'm running Ruby 1.8.6 over WinXP-Pro/SP3

No idea. However, the "regular" debugger does not have that issue:

Robert@babelfish ~
$ ruby19 -r debug x.rb
Debug.rb
Emacs support available.

x.rb:1:a = 'aaa'
(rdb:1) l
[-4, 5] in x.rb
=> 1 a = 'aaa'
2 b = 'bbb'
3 # breakpoint
4 c = 'ccc'
(rdb:1) b 4
Set breakpoint 1 at x.rb:4
(rdb:1) v l
a => nil
b => nil
c => nil
(rdb:1) c
Breakpoint 1, toplevel at x.rb:4
x.rb:4:c = 'ccc'
(rdb:1) v l
a => "aaa"
b => "bbb"
c => nil
(rdb:1) n

Robert@babelfish ~
$

Note: "v l" lists local variables.

Kind regards

robert
 
R

RichardOnRails

2010/5/31 RichardOnRails <[email protected]>:


I've got a 7-liner:
require 'rubygems'
require 'breakpoint'
a = 'aaa'
b = 'bbb'
breakpoint
c = 'ccc'
In a Command window, I've got:
K:\_Projects\Ruby\_Ruby_Tests\TestBreakpoint>ruby TestBreakpoint.rb
Executing break point at TestBreakpoint.rb:9
irb(main):001:0> local_variables
=> ["id", "block", "_"]
irb(main):002:0> quit
This test is based on Recipe 17.10 of the Ruby Cookbook, O'Reilly,
2006
Why doesn't the array allegedly presenting local variables:
1. Include a, b & c?
2. Present the things it does; what do they signify?
I'm running Ruby 1.8.6 over WinXP-Pro/SP3

No idea.  However, the "regular" debugger does not have that issue:

Robert@babelfish ~
$ ruby19 -r debug x.rb
Debug.rb
Emacs support available.

x.rb:1:a = 'aaa'
(rdb:1) l
[-4, 5] in x.rb
=> 1  a = 'aaa'
   2  b = 'bbb'
   3  # breakpoint
   4  c = 'ccc'
(rdb:1) b 4
Set breakpoint 1 at x.rb:4
(rdb:1) v l
  a => nil
  b => nil
  c => nil
(rdb:1) c
Breakpoint 1, toplevel at x.rb:4
x.rb:4:c = 'ccc'
(rdb:1) v l
  a => "aaa"
  b => "bbb"
  c => nil
(rdb:1) n

Robert@babelfish ~
$

Note: "v l" lists local variables.

Kind regards

robert

Hi Robert,

Thanks for your reply. It led me to realize that I had mixed up two
debuggers. I'm using the command "rdebug x.rb" and it appears to
invoke ruby-debug. That works great!

I wanted to elect some options for ruby-debug but could not find the
file recommended by some online documentation: rdebugrc. I hten found
another recommendation for Windows:rdebug.ini. That doesn't exist
either.

I found an rdebug file with no extension in the directory where Ruby
is installed. It's a ~200-line Ruby program that looks like a driver
for the Debugger, so that doesn't look like a place for me to try to
customize the options.

This is not a big deal. But if anything comes to mind, I'd be
grateful to learn about it.

Best wishes,
Richard
 
R

RichardOnRails

2010/5/31 RichardOnRails <[email protected]>:
Hi,
I've got a 7-liner:
require 'rubygems'
require 'breakpoint'
a = 'aaa'
b = 'bbb'
breakpoint
c = 'ccc'
In a Command window, I've got:
K:\_Projects\Ruby\_Ruby_Tests\TestBreakpoint>ruby TestBreakpoint.rb
Executing break point at TestBreakpoint.rb:9
irb(main):001:0> local_variables
=> ["id", "block", "_"]
irb(main):002:0> quit
This test is based on Recipe 17.10 of the Ruby Cookbook, O'Reilly,
2006
Why doesn't the array allegedly presenting local variables:
1. Include a, b & c?
2. Present the things it does; what do they signify?
I'm running Ruby 1.8.6 over WinXP-Pro/SP3
No idea.  However, the "regular" debugger does not have that issue:
Robert@babelfish ~
$ ruby19 -r debug x.rb
Debug.rb
Emacs support available.
x.rb:1:a = 'aaa'
(rdb:1) l
[-4, 5] in x.rb
=> 1  a = 'aaa'
   2  b = 'bbb'
   3  # breakpoint
   4  c = 'ccc'
(rdb:1) b 4
Set breakpoint 1 at x.rb:4
(rdb:1) v l
  a => nil
  b => nil
  c => nil
(rdb:1) c
Breakpoint 1, toplevel at x.rb:4
x.rb:4:c = 'ccc'
(rdb:1) v l
  a => "aaa"
  b => "bbb"
  c => nil
(rdb:1) n
Robert@babelfish ~
$
Note: "v l" lists local variables.
Kind regards

Hi Robert,

Thanks for your reply.  It led me to realize that I had mixed up two
debuggers.  I'm using the command "rdebug x.rb" and it appears to
invoke ruby-debug.  That works great!

I wanted to elect some options for ruby-debug but could not find the
file recommended by some online documentation: rdebugrc. I hten found
another recommendation for Windows:rdebug.ini.  That doesn't exist
either.

I found an rdebug file with no extension in the directory where Ruby
is installed. It's a ~200-line Ruby program that looks like a driver
for the Debugger,  so that doesn't look like a place for me to try to
customize the options.

This is not a big deal.  But if anything comes to mind, I'd be
grateful to learn about it.

Best wishes,
Richard

Hi Robert,

Please forgot about my last question. I found comprehensive
documentation at http://bashdb.sourceforge.net/ruby-debug, do I'll be
fine.

Thanks again,
Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top