Forum: JRuby step through debugging for jruby?

Posted by Roger Pack (rogerdpack)
on 2010-02-05 00:34
Anybody know of a step through debugger for jruby?

It looks like you can use the pure ruby version:

jruby --debug -rdebug go.rb

but what do people out there use besides that?


-r
Posted by James Abley (Guest)
on 2010-02-05 13:38
(Received via mailing list)
Netbeans
Posted by Christopher Jeris (Guest)
on 2010-02-05 16:42
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roger Pack wrote:
> Anybody know of a step through debugger for jruby?
> 
> It looks like you can use the pure ruby version:
> 
> jruby --debug -rdebug go.rb
> 
> but what do people out there use besides that?

I use Aptana/RadRails, which is far from perfect, but works well enough
to muddle through.  You need to install the Java ruby-debug-base and
ruby-debug-ide gems from http://debug-commons.rubyforge.org/ if you
haven't done so already.  The biggest problem is that the
local-variables pane will occasionally lose its connection to reality,
forcing you to delete and re-add it to see the frame-local variables 
again.

At the time I tested IDEs, ActiveState Komodo did not appear to support
JRuby, and RubyMine's debugger did very strange things (like stepping to
a choice of line and file apparently chosen completely at random).  I
didn't spend much time with NetBeans because of other issues, not the
debugger.  I'm on Windows, so probably get a worse experience than most.

hope this helps, Chris Jeris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFLbDxA5ICCNV0oGWARApvCAKCV22KzNbttYRMv1lmJ6jKlXlncPQCfVVUX
R1lspovwZVV8Pod3F8ve10c=
=eSee
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Roger Pack (rogerdpack)
on 2010-02-05 18:44
James Abley wrote:
> Netbeans

Any command liners out there?
-r
Posted by Chad Woolley (thewoolleyman)
on 2010-02-05 20:26
(Received via mailing list)
> Any command liners out there?

What is the state of jruby command line debug?  I just tried it with
RVM using jruby 1.4.0 (ruby 1.8.7 patchlevel 174)

The ruby-debug gem fails to install because it is native (and no java 
platform).

Does command line debugging work under Jruby, and if so, are there any
up-to-date docs/tutorials?

Thanks,
-- Chad

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Jonas Tingeborn (Guest)
on 2010-02-05 22:26
(Received via mailing list)
> Roger Pack wrote:
> 
>     Anybody know of a step through debugger for jruby?
...
>     but what do people out there use besides that?

Eclipse & Netbeans.

Eclipse is OK, but can't hold a candle compared to Netbeans.
I usually fire up Netbeans when I make more complicated ruby stuff since
  the ruby support in that IDE is great and not just a shaky bolt-on,
which is the feeling when using RDT for Eclipse.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Richard Conroy (Guest)
on 2010-02-05 22:58
(Received via mailing list)
On Fri, Feb 5, 2010 at 3:41 PM, Christopher Jeris 
<cjeris@fas.harvard.edu>wrote:
> debugger.  I'm on Windows, so probably get a worse experience than most.
>
>
I use netbeans a lot, and I find it really levels the playing field on
windows,
dont do a lot of debugging, so I cant comment on how useful that is.
Posted by Stephen Bannasch (Guest)
on 2010-02-08 07:31
(Received via mailing list)
At 12:25 PM -0700 2/5/10, Chad Woolley wrote:
> > Any command liners out there?
>
>What is the state of jruby command line debug?  I just tried it with
>RVM using jruby 1.4.0 (ruby 1.8.7 patchlevel 174)

See the wiki page: 
http://kenai.com/projects/jruby/pages/UsingTheJRubyDebugger

For the debug gem is included as part of the source for 1.5.0dev -- I 
think it is included in jruby-complete.jar for 1.5.0dev but am not sure.

>The ruby-debug gem fails to install because it is native (and no java platform).
>
>Does command line debugging work under Jruby, and if so, are there any
>up-to-date docs/tutorials?

I use command line debugging all the time with JRuby -- it works great.

I've also installed rdebug-ide and when I need more support than I can 
get just using command line debugging I hook up trdebug-ide to hook up 
programs I start in the command line to a remote debugging Ruby session 
NetBeans.

Here's an example where I am debugging a ruby program that uses 
activerecord called ar_to_xml.rb -- I start the debugging session in a 
console:

  $ jruby --debug -S rdebug-ide -p 7000 --stop -- ar_to_xml.rb

I'm telling rdebug-ide to communicate over port 7000 with whatever IDE 
is listening there and to  stop after starting and wait for the IDE 
debugging system to tell the program to continue. Everything after the 
'--' is used to tell rdebug what to run.

After starting the ruby program I switch to NetBeans and start the ruby 
debugger by selecting the menu: "Debug::AttachDebugger ..." and then 
selecting the "Ruby Debugger (ruby-debug-ide)" from the list.

I can set breakpoints, watch statements, etc in NB at any level and NB 
will remember these the subsequent times I run the ruby program.

Martin Krauskopf describe more about this here:

  http://blogs.sun.com/martink/entry/remote_debugging_debug_whatever_ruby

Debuuging JRuby itself:

When I am debugging JRuby's java code I use Eclipse and a class I wrote 
called JRubyRunner. The key here is that to run theEclipse Java debugger 
I need to be in a project that has a "Java perspective" from the Eclipse 
point of view (theprojectthat has the class JRubyRunner meets that 
qualification) but ... in order to startup JRuby to investigate a bug or 
new featureI am adding I need to start a Ruby program. Using JRubyRunner 
I can select a Ruby file anywhere in my Eclipse workspaceand runit with 
JRubyRunner and if I run it with the Eclipse debugger and breakpoints I 
can now easily get right into JRub's java codeto see what's going on.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Daniel Lucraft (Guest)
on 2010-02-08 08:00
(Received via mailing list)
That is useful, thanks.

Well, Roger, do you want to make the first stab at hooking this up to 
Redcar or shall I? ;)

Dan

_______________________________
Daniel Lucraft

twitter.com/danlucraft
danlucraft.com/blog




On 8 Feb 2010, at 06:29, Stephen Bannasch wrote:

>> The ruby-debug gem fails to install because it is native (and no java platform).
>  $ jruby --debug -S rdebug-ide -p 7000 --stop -- ar_to_xml.rb
> 
> Debuuging JRuby itself:
> 
> When I am debugging JRuby's java code I use Eclipse and a class I wrote called JRubyRunner. The key here is that to run theEclipse Java debugger I need to be in a project that has a "Java perspective" from the Eclipse point of view (theprojectthat has the class JRubyRunner meets that qualification) but ... in order to startup JRuby to investigate a bug or new featureI am adding I need to start a Ruby program. Using JRubyRunner I can select a Ruby file anywhere in my Eclipse workspaceand runit with JRubyRunner and if I run it with the Eclipse debugger and breakpoints I can now easily get right into JRub's java codeto see what's going on.
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Roger Pack (rogerdpack)
on 2010-02-08 14:43
> Well, Roger, do you want to make the first stab at hooking this up to 
> Redcar or shall I? ;)

LOL.

You probably can start on it since I'll probably still be using 
1.9+rdebug for awhile (except for when I hack on redcar itself--then 
I'll probably use the debugger now...I realize my attempt to get it to 
work was apparently my own ineptitude).  My next redcar plugin "might" 
be one that wraps a popen and outputs it/takes input...that could be 
interesting.

-r
Posted by Roger Pack (rogerdpack)
on 2010-02-13 20:27
> See the wiki page: 
> http://kenai.com/projects/jruby/pages/UsingTheJRubyDebugger
...
> I use command line debugging all the time with JRuby -- it works great.

Interesting.
For me using those libs ruby-debug doesn't show the lines right--they're 
mangled together or not the right line number. At least I am a bit 
closer. Hmm...
-r
Posted by Brendan Grainger (Guest)
on 2010-02-15 17:06
(Received via mailing list)
Hi Roger,

Did you make sure to include --debug option?

jruby --debug -S ...

I've noticed the line numbers being messed up when I've accidentally 
left this option off.

Brendan

On Feb 13, 2010, at 2:27 PM, Roger Pack wrote:

> -r
> -- 
> Posted via http://www.ruby-forum.com/.
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Roger Pack (rogerdpack)
on 2010-02-19 22:57
> jruby --debug -S ...
> 
> I've noticed the line numbers being messed up when I've accidentally 
> left this option off.

Interesting.
Today it seems to be working like a champ.  Dunno what the problem 
was...maybe I was stepping through a file with mixed "\n" and "\r\n" 
line endings or something odd like that.

Anyway, without --debug it appears to still debug, it just steps "into" 
everything instead of "over" (i.e. it's like "next" means "step" 
always).
with --debug next seems to work as expected.
Thanks for the tip!
-rp
Posted by Charles Nutter (headius)
on 2010-03-02 20:47
(Received via mailing list)
On Fri, Feb 19, 2010 at 3:57 PM, Roger Pack <lists@ruby-forum.com> 
wrote:
> Interesting.
> Today it seems to be working like a champ.  Dunno what the problem
> was...maybe I was stepping through a file with mixed "\n" and "\r\n"
> line endings or something odd like that.
>
> Anyway, without --debug it appears to still debug, it just steps "into"
> everything instead of "over" (i.e. it's like "next" means "step"
> always).
> with --debug next seems to work as expected.

FWIW, JRuby 1.5 will preinstall ruby-debug. Snapshots already do.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.