# Ruby breakpoint has weird idea of what local\_variables are?

**URL:** <https://www.ruby-forum.com/t/ruby-breakpoint-has-weird-idea-of-what-local-variables-are/189429>\
**Category:** Ruby\
**Created:** [May 31, 2010, 9:05pm UTC](https://www.ruby-forum.com/t/ruby-breakpoint-has-weird-idea-of-what-local-variables-are/189429 "2010-05-31T21:05:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [May 31, 2010, 9:05pm UTC](https://www.ruby-forum.com/t/ruby-breakpoint-has-weird-idea-of-what-local-variables-are/189429/1 "2010-05-31T21:05:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [May 31, 2010, 9:16pm UTC](https://www.ruby-forum.com/t/ruby-breakpoint-has-weird-idea-of-what-local-variables-are/189429/2 "2010-05-31T21:16:53Z")

</div>

2010/5/31 RichardOnRails [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [June 5, 2010, 3:55am UTC](https://www.ruby-forum.com/t/ruby-breakpoint-has-weird-idea-of-what-local-variables-are/189429/3 "2010-06-05T03:55:38Z")

</div>

On May 31, 3:16 pm, Robert K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > a = ‘aaa’
> 
> 3 # breakpoint  
> (rdb:1) v l  
> Kind regards
> 
> robert
> 
> –  
> remember.guy do |as, often| as.you\_can - without endhttp://blog.rubybestpractices.com/

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

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [June 5, 2010, 4:10am UTC](https://www.ruby-forum.com/t/ruby-breakpoint-has-weird-idea-of-what-local-variables-are/189429/4 "2010-06-05T04:10:17Z")

</div>

On Jun 4, 9:53 pm, RichardOnRails  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > require ‘breakpoint’  
> > > =\> [“id”, “block”, “\_”]
> 
> > =\> 1 a = ‘aaa’  
> > Breakpoint 1, toplevel at x.rb:4  
> > Note: “v l” lists local variables.  
> > Thanks for your reply. It led me to realize that I had mixed up two  
> > 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 [ruby-debug](http://bashdb.sourceforge.net/ruby-debug), do I’ll be  
fine.

Thanks again,  
Richard
