Ok, I did the same and got a little farther.  I've patched JRuby as you
suggested and built a jruby-debug.jar and put in JRUBY_HOME/lib.  Then I
tried running jruby rdebug (I copied this from ruby-debug gem).
Unfortunately it appears jruby trunk is a bit unstable right now and your
code has been broken by changes to it :(

Here's what I've found thus far:

JRuby compiler appears to be broken right now for executing code which sets
a module constant.  Running the following with jit enabled will throw a
NoMethodError: "Foo:BAR = 1".

I disabled JIT and that got me a littler farther, but I soon hit another
NoMethodError in the debug code, it appears that
ThreadContext.getFrameArgshas been removed.  Not sure what we should
use as a replacement.

I can file a JIRA issue for the first one.  I know there is some pretty
major refactoring going on in trunk, so should we wait a bit before trying
to get fast debug working?  I don't mind addressing things one at a time as
time permits, but if it's pretty likely the code would need to change again
real soon I'd rather wait.

--Chris

On 9/24/07, Martin Krauskopf <[EMAIL PROTECTED]> wrote:
>
> Chris Nelson wrote:
> > Been attempting to try out Martin's jruby-debug code from debug-commons
> > and haven't been able to get much of anywhere.  I assume I'm missing
> > something rather obvious, but I have not been able to get it to load.  I
> > had to make a small change to jruby trunk for Martin's code to compile
> > (making RubyThread constructor protected instead of private) and then I
> > was able to compile and build a jruby-debug.jar file.  However, how is
> > this library designed to be loaded?  I tried the obvious, doing require
> > 'jruby-debug.jar' in a ruby script.  This didn't work, as the code that
> > tries to find a java extension library expects to find a class that
> > implements BasicLibraryService, whereas the jruby-debug code has
> > RubyDebugBaseLibrary which implements Library (not
> > BasicLibraryService).  It appears the right way to use this code would
> > be to have it added using registerBuiltIn in Ruby.initLibraries so it
> > will be used when any code does require 'ruby_debug.so'.  Is there a
> > different way to do this other than adding a line to Ruby.java?
>
> Hi Chris,
>
> this is exactly what I did. I have patched JRuby's trunk on my disk in
> a way you described[1].
> To be honest I did not care too much about the best integration with
> JRuby since it does not prevent me from working on jruby-debug at all. I
> would start to solving this after there is something usable for JRuby
> users which is far from true in the meantime.
> Looking forward to your patches, contributions! ;)
>
> Regards,
>         m.
>
> PS: I'll add note about this to the jruby-debug's README.
>
> [1]
> svn di src/org/jruby/RubyThread.java src/org/jruby/Ruby.java
> Index: src/org/jruby/RubyThread.java
> ===================================================================
> --- src/org/jruby/RubyThread.java       (revision 4363)
> +++ src/org/jruby/RubyThread.java       (working copy)
> @@ -266,7 +266,7 @@
>           }
>       }
>
> -    private RubyThread(Ruby runtime, RubyClass type) {
> +    public RubyThread(Ruby runtime, RubyClass type) {
>           super(runtime, type);
>           this.threadService = runtime.getThreadService();
>           // set to default thread group
> Index: src/org/jruby/Ruby.java
> ===================================================================
> --- src/org/jruby/Ruby.java     (revision 4363)
> +++ src/org/jruby/Ruby.java     (working copy)
> @@ -67,6 +67,7 @@
>   import org.jruby.compiler.NotCompilableException;
>   import org.jruby.compiler.impl.StandardASMCompiler;
>   import org.jruby.compiler.yarv.StandardYARVCompiler;
> +import org.jruby.debug.RubyDebugBaseLibrary;
>   import org.jruby.evaluator.EvaluationState;
>   import org.jruby.exceptions.JumpException;
>   import org.jruby.exceptions.RaiseException;
> @@ -739,6 +740,7 @@
>
>           registerBuiltin("socket.rb", new RubySocket.Service());
>           registerBuiltin("rbconfig.rb", new RbConfigLibrary());
> +        registerBuiltin("ruby_debug.so", new RubyDebugBaseLibrary());
>
>           for (int i=0; i<BUILTIN_LIBRARIES.length; i++) {
>               if(profile.allowBuiltin(BUILTIN_LIBRARIES[i])) {
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

Reply via email to