[Ironruby-core] Debugging rubyspecs

Shri Borde Shri.Borde at microsoft.com
Thu Feb 19 13:24:26 EST 2009


The following command runs a single spec, and only launches ir.exe once. Note that the command launches mspec-run.rb which does not spawn any processes. The other runners like mspec-ci etc do spawn a new process for mspec-run.rb.

c:\vsl\Merlin\Main>c:\vsl\Merlin\Main\bin\debug\ir.exe -v -X:Interpret c:/vsl/Merlin/External/Languages/IronRuby/mspec/mspec/bin/mspec-run -e "caches" -fs -V -B c:/vsl/Merlin/External/Languages/IronRuby/mspec/default.mspec c:/vsl/Merlin/External/Languages/IronRuby/mspec/rubyspec/language/regexp_spec.rb

Also, note that in my previous command line, I had an extra "1.8". This was needed for an earlier version of mspec, but should not be used anymore. I have updated the wiki with the latest instructions that I have verified work for me and allow me to hit a breakpoint where I expect.

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pete Bacon Darwin
Sent: Thursday, February 19, 2009 6:21 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Debugging rubyspecs

Hi Shri and Jimmy,

Thanks for the suggestions.  What version of mspec are you running?  I am running the head version directly from rubyspecs github: "d482804 Added should have_constant matcher."

In my version, the initial ruby process kicks off a new ruby process (potentially a completely different implementation, like JRuby or Rubinius) for each test run.  So there is no point in debugging the initial process.

Shri, on my machine your instructions below result in "unknown: Unable to find a suitable ruby executable. (Exception)", which I guess is mspec telling me it couldn't load ir.exe or equivalent as a sub-process for executing the spec.

Jimmy, how do you attach to the mspec process in the first place?  The same problem as above is true for just debugging mspec run ...

Pete

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde
Sent: Wednesday,18 February 18, 2009 17:59
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Debugging rubyspecs

Here is what I added to http://wiki.github.com/ironruby/ironruby. This works pretty well for me. If the paths are incorrect, feel free to update the wiki.

Debugging with Visual Studio
In the Debug tab of the Project properties for Ruby.Console.csproj, set the fields as follows:

 *   Start Action: For Ruby.Console.csproj, "Start project" should be enabled.
For any other project, "Start external program:" should be enabled and set to "c:\vsl\Merlin\Main\Bin\Debug\ir.exe"

 *   Start Options: "Command line arguments" should be set to the following for running the "supports /i for ignoring case" example of string\gsub_spec.rb:
-v -X:Interpret c:/vsl/Merlin/External/Languages/IronRuby/mspec/mspec/bin/mspec-run -e "supports /i for ignoring case" -fs -V -B c:/vsl/Merlin/External/Languages/IronRuby/mspec/default.mspec c:/vsl/Merlin/External/Languages/IronRuby/mspec/rubyspec/1.8/core/string/gsub_spec.rb
Hitting F5 should now run the single RubySpec example under VS


Thanks,
Shri

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi
Sent: Wednesday, February 18, 2009 8:52 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Debugging rubyspecs

You can pass the spec file to mspec itself like:

mspec run core/io/popen_close

Then I make a call to "debugger" http://gist.github.com/61605, which breaks on a call to System::Diagnostics::Debugger when a debugger is attached to the app. Unfortunately this breaks in a Ruby method, so you have to jump up a couple CLR frames to get to the line directly after the "debugger" call, and I'm not sure of a way how to do that automatically. Anyway, this works great.

~js

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pete Bacon Darwin
Sent: Wednesday, February 18, 2009 8:11 AM
To: 'Pete Bacon Darwin'; ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Debugging rubyspecs

The easiest way it appears is to stick a pause in the rubyspec of interest and attach to the process while it is waiting.  It does totally kill the computer performance while you are debugging (like minutes to step through each line!)
Pete

From: Pete Bacon Darwin [mailto:bacondarwin at googlemail.com]
Sent: Wednesday,18 February 18, 2009 15:19
To: 'ironruby-core at rubyforge.org'
Subject: Debugging rubyspecs

Anybody know how to run rubyspecs under the Visual Studio debugger?  If I just set the rubyspec file as the command line argument in the debug properties in VS then it just asks me to install mspec as a gem.
Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090219/89d35fce/attachment.html>


More information about the Ironruby-core mailing list