From: RichardOnRails Date: 2010-06-05T10:55:07+09:00 Subject: Re: Ruby breakpoint has weird idea of what local_variables are? On May 31, 3:16 pm, Robert Klemme wrote: > 2010/5/31 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 > > 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 > > -- > 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