[Ironruby-core] Confused and Dazed

Jimmy Schementi Jimmy.Schementi at microsoft.com
Tue Oct 6 16:11:15 EDT 2009

Tom Groff wrote:
> Shri Borde wrote:
> > http://wiki.github.com/ironruby/ironruby/debugging can get you started
> > on debugging
> In my dreams.

Patience, this is what mailing lists are for :) More thorough documentation is on its way as it gets closer to 1.0.
> I seem to be missing some very basic steps to getting started with Iron Ruby.
> Documentation keeps talking about something called Merlin?
> Opening VS.NET and looking at opening a project shows no templates for IR.
> I would have thought that would be the first step.
> Can someone break this down for me?

Those instructions are geared towards contributors to IronRuby debugging Ruby code, as it is on GitHub. "Merlin" is a directory in the IronRuby source tree. However, replacing "c:\vsl\Merlin\Main\Bin\Debug" with your path to "ir.exe" (if you have the latest path, it's "wherever/you/unzipped/it/bin/ir.exe") is good enough for most of that documentation.

Visual Studio does not have any IronRuby project-system support when you install it. However, being able to debug a IronRuby script is entirely dependent on IronRuby providing the correct information to the Visual Studio debugger. Though the support isn't great, you can place breakpoints in a Ruby script and step through it in VS:

1. Place a "gets" call as the first line of the Ruby script.
2. Run "ir.exe -D yourrubyscript.rb
3. Launch VS, and open yourrubyscript.rb.
4. Place a breakpoint somewhere in your code.
5. Launch VS, and go-to Tools > Attach to Process
6. Select the ir.exe process.
7. Switch back to your running Ruby script, and press "Enter". Now the script will run and the debugger will break at your breakpoint in Ruby code.

Support for IronRuby debugging in VS has plenty of room to get better, especially if we had a project-system for Ruby to remove the need for starting the process yourself and attaching to it. We could also be better about emitting debug information so stepping into blocks/ifs/whiles/etc where easier/possible. Also, if IronRuby supported ruby-debug (which it does not today), then IronRuby could be debugged by any existing Ruby IDE. 

Today I use this very simple Ruby script to debug my IronRuby code: http://gist.github.com/116393. It just gives you a little repl loop wherever you ask for it; like "ruby-debug" but without the ability to step.

Let me know if you have any more questions about debugging in Visual Studio, and keep an eye on this list for more information about Ruby debugging as we get closer to 1.0.


More information about the Ironruby-core mailing list