Discussion:
[jruby-dev] Fast debugger? (was Re: [jruby-dev] JRuby 1.1 Roadmap)
Chris Nelson
2007-08-17 18:32:59 UTC
Permalink
Guys,

This sounds like an awesome list of stuff, but a feature that I think would
help a lot of with JRoR projects would be to improve the debugging
experience. Right now the only way to get JRuby on Rails debugging to work
in NetBeans is by setting an undocumented property in a config file. And
even then, it's quite buggy. From what I understand Netbeans needs to have
the fast debugger supported in JRuby before this situation will improve. I
would be willing to lend a hand on this if someone could point me in the
right direction. I've done a ton of Java and am doing more Ruby all the
time, but I'm not too familiar with the internals of JRuby or how this would
need to work.

Thanks in advance,

Chris
Here's the proposed 1.1 roadmap Tom, Nick and I came up with this
afternoon. Add remove as you see fit, we'll try to iron it out.
- compiler complete
- AOT compilation working with jrubyc
- stdlib all precompiled
- gem install precompilation
- virtual filesystem-inside-JVM (maybe) or hacked rubygems that can
run out of an archive
- performance improvement to be quantified...java integration,
execution, memory reduction
- yarv bytecode execution and compilation (maybe)
- AST sharing as an option (sharing across runtimes)...need to
explore AOT compilation and its (positive?) effect on memory too
- real threading brutalization, testably multithread-safe core
classes (maybe, needs heavy testing on many-core systems)
- Java API rubification, perhaps with require 'javax.swing' and so on
- RubyConf for release
I accept responsibility for the compiler stuff, and I'm confident I can
have it all done by then. The big remaining items are tough, but there's
two months.
All told, it should be a pretty wicked release.
- Charlie
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Charles Oliver Nutter
2007-08-17 19:35:13 UTC
Permalink
Post by Chris Nelson
Guys,
This sounds like an awesome list of stuff, but a feature that I think
would help a lot of with JRoR projects would be to improve the debugging
experience. Right now the only way to get JRuby on Rails debugging to
work in NetBeans is by setting an undocumented property in a config
file. And even then, it's quite buggy. From what I understand Netbeans
needs to have the fast debugger supported in JRuby before this situation
will improve. I would be willing to lend a hand on this if someone
could point me in the right direction. I've done a ton of Java and am
doing more Ruby all the time, but I'm not too familiar with the
internals of JRuby or how this would need to work.
Hey, an offer of help! That's what I like to see!

Basically, fast debugging in JRuby is just waiting for someone to
implement a ruby-debug library port. The plumbing is basically there in
JRuby already to support it, and I stubbed out most of the Java code
that would be required to hook it up (somewhere in SVN), so it's really
just about hooking up the functionality.

On the down side of debugging, the compiled code currently doesn't fire
all the various hooks needed to response to debugging or profiling
libraries.

In the short term, that just means that debugging code will run a bit
slower, since it won't use the compiler. But that's far from
unusable...the interpreter still performs pretty well, and debugging
doesn't have to run at full-speed anyway

Long term, I will probably bite the bullet and add in the appropriate
hooks. But not right now.

So basically, you should get familiar with the ruby-debug library, take
the stub code I implemented, and run with it. And try to get others to
help you; this is a fairly ugly gap in our Ruby support.

- Charlie

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

http://xircles.codehaus.org/manage_email
Martin Krauskopf
2007-08-17 20:06:23 UTC
Permalink
Post by Chris Nelson
Guys,
This sounds like an awesome list of stuff, but a feature that I think
would help a lot of with JRoR projects would be to improve the debugging
experience. Right now the only way to get JRuby on Rails debugging to
work in NetBeans is by setting an undocumented property in a config
file. And even then, it's quite buggy. From what I understand Netbeans
needs to have the fast debugger supported in JRuby before this situation
will improve. I would be willing to lend a hand on this if someone
could point me in the right direction. I've done a ton of Java and am
doing more Ruby all the time, but I'm not too familiar with the
internals of JRuby or how this would need to work.
Hi Chris,

I've rewritten a lot of ruby_debug.c (76kB of C code) into the JRuby
based Java code. I started with empty skeleton written by Charles
(src/org/jruby/debug/RubyDebugBaseLibrary.java in headius branch).

Currently I'm having:

Context.java
DebugBreakpoint.java
DebugEventHook.java
DebuggerContext.java
DebuggerDef.java
DebuggerFrame.java
Debugger.java
RubyDebugBaseLibrary.java
Util.java

But it's one big mess, since I started in very similar position as you.
A lot of Java coding, some Ruby coding, 8+ year ago C coding. So I'm
still deleting and rewriting what I wrote as I'm getting into the JRuby
APIs (BTW purely documented guys! ;) )
I did not expect anyone to join so I did not share the code anywhere.
And actually I'm not sure if it is sharable yet ;)
Probably I could commit something soon into debug-commons at
rubyforge.org (right place?) after some clean-up. But not sure how much
time I find in the next few days. I would let you know. Also depending
how soon are you willing to start. Probably immediately? :)

m.

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

http://xircles.codehaus.org/manage_email
Martin Krauskopf
2007-08-17 20:11:34 UTC
Permalink
Post by Martin Krauskopf
Post by Chris Nelson
Guys,
This sounds like an awesome list of stuff, but a feature that I think
would help a lot of with JRoR projects would be to improve the
debugging experience. Right now the only way to get JRuby on Rails
debugging to work in NetBeans is by setting an undocumented property
in a config file. And even then, it's quite buggy. From what I
understand Netbeans needs to have the fast debugger supported in JRuby
before this situation will improve. I would be willing to lend a hand
on this if someone could point me in the right direction. I've done a
ton of Java and am doing more Ruby all the time, but I'm not too
familiar with the internals of JRuby or how this would need to work.
Hi Chris,
I've rewritten a lot of ruby_debug.c (76kB of C code) into the JRuby
based Java code. I started with empty skeleton written by Charles
(src/org/jruby/debug/RubyDebugBaseLibrary.java in headius branch).
Context.java
DebugBreakpoint.java
DebugEventHook.java
DebuggerContext.java
DebuggerDef.java
DebuggerFrame.java
Debugger.java
RubyDebugBaseLibrary.java
Util.java
But it's one big mess, since I started in very similar position as you.
A lot of Java coding, some Ruby coding, 8+ year ago C coding. So I'm
still deleting and rewriting what I wrote as I'm getting into the JRuby
APIs (BTW purely documented guys! ;) )
Ups. Should be "poorly". Sorry :)

m.

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

http://xircles.codehaus.org/manage_email
Charles Oliver Nutter
2007-08-17 20:46:22 UTC
Permalink
Post by Martin Krauskopf
Post by Martin Krauskopf
But it's one big mess, since I started in very similar position as
you. A lot of Java coding, some Ruby coding, 8+ year ago C coding. So
I'm still deleting and rewriting what I wrote as I'm getting into the
JRuby APIs (BTW purely documented guys! ;) )
Ups. Should be "poorly". Sorry :)
That it is! So as of today, we officially accept documentation patches.
Open the floodgates!

- Charlie

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

http://xircles.codehaus.org/manage_email
Chris Nelson
2007-08-17 20:57:46 UTC
Permalink
Hi Martin,

I recognize you from Netbeans Issuezilla :) It's great to hear someone has
already started on this. Sounds I'm starting at the same place you did:
looking at the ruby-debug-base c code and looking for the native methods we
would need to implement in JRuby. Charles, is this headius branch the stub
code you were referring to? It's marked as 0.9.3, is it still up to date?

Whenever you are ready, I'm happy to look at what you have and see where I
can contribute. It will probably take me a bit to come up to speed, in
looking briefly at the headius branch stub methods I'm pretty much without a
clue as to where the JRuby API code is to implement them. But I'm willing
to learn, any pointers and/or docs would be welcomed.

--Chris
Post by Martin Krauskopf
Post by Martin Krauskopf
Post by Chris Nelson
Guys,
This sounds like an awesome list of stuff, but a feature that I think
would help a lot of with JRoR projects would be to improve the
debugging experience. Right now the only way to get JRuby on Rails
debugging to work in NetBeans is by setting an undocumented property
in a config file. And even then, it's quite buggy. From what I
understand Netbeans needs to have the fast debugger supported in JRuby
before this situation will improve. I would be willing to lend a hand
on this if someone could point me in the right direction. I've done a
ton of Java and am doing more Ruby all the time, but I'm not too
familiar with the internals of JRuby or how this would need to work.
Hi Chris,
I've rewritten a lot of ruby_debug.c (76kB of C code) into the JRuby
based Java code. I started with empty skeleton written by Charles
(src/org/jruby/debug/RubyDebugBaseLibrary.java in headius branch).
Context.java
DebugBreakpoint.java
DebugEventHook.java
DebuggerContext.java
DebuggerDef.java
DebuggerFrame.java
Debugger.java
RubyDebugBaseLibrary.java
Util.java
But it's one big mess, since I started in very similar position as you.
A lot of Java coding, some Ruby coding, 8+ year ago C coding. So I'm
still deleting and rewriting what I wrote as I'm getting into the JRuby
APIs (BTW purely documented guys! ;) )
Ups. Should be "poorly". Sorry :)
m.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Charles Oliver Nutter
2007-08-17 21:04:17 UTC
Permalink
Post by Chris Nelson
Hi Martin,
I recognize you from Netbeans Issuezilla :) It's great to hear someone
has already started on this. Sounds I'm starting at the same place you
did: looking at the ruby-debug-base c code and looking for the native
methods we would need to implement in JRuby. Charles, is this headius
branch the stub code you were referring to? It's marked as 0.9.3, is it
still up to date?
Whenever you are ready, I'm happy to look at what you have and see where
I can contribute. It will probably take me a bit to come up to speed,
in looking briefly at the headius branch stub methods I'm pretty much
without a clue as to where the JRuby API code is to implement them. But
I'm willing to learn, any pointers and/or docs would be welcomed.
It sounds like Martin's already taken the stub code and started to run
with it, so I think his stuff is the best place to start contributing.

So Martin, Chris...figure out how you can help each other :)

- Charlie

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

http://xircles.codehaus.org/manage_email
Chris Nelson
2007-08-17 21:29:52 UTC
Permalink
Cool. It's a plan!

Martin, here's one idea for how we can collaborate. Since test cases are my
favorite kind of documentation, maybe we can us them to help us get
started. Here are some different approaches we could use depending on where
things are at now:

Good: If your code does not have test cases perhaps I can help write them
and thereby come to an understanding of it.
Better: If there are test cases already, I'll start by reading and running
them and come up to speed that much more quickly.
Best: If you have some failing test cases for code not yet implemented, I'll
start in on trying to make them pass.

Look forward to working with you,

--Chris
Post by Charles Oliver Nutter
Post by Chris Nelson
Hi Martin,
I recognize you from Netbeans Issuezilla :) It's great to hear someone
has already started on this. Sounds I'm starting at the same place you
did: looking at the ruby-debug-base c code and looking for the native
methods we would need to implement in JRuby. Charles, is this headius
branch the stub code you were referring to? It's marked as 0.9.3, is it
still up to date?
Whenever you are ready, I'm happy to look at what you have and see where
I can contribute. It will probably take me a bit to come up to speed,
in looking briefly at the headius branch stub methods I'm pretty much
without a clue as to where the JRuby API code is to implement them. But
I'm willing to learn, any pointers and/or docs would be welcomed.
It sounds like Martin's already taken the stub code and started to run
with it, so I think his stuff is the best place to start contributing.
So Martin, Chris...figure out how you can help each other :)
- Charlie
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Raphaël Valyi
2007-08-17 23:35:30 UTC
Permalink
Post by Chris Nelson
Cool. It's a plan!
Martin, here's one idea for how we can collaborate. Since test cases are
my favorite kind of documentation, maybe we can us them to help us get
started. Here are some different approaches we could use depending on where
I also think test cases is a good way to actually document the exact API.
Indeed, there is nothing worst than an old documentation that should be
checked over and over against the evolving code. I even saw Apache official
documentation loosing sync in a way that methods being deprecated in the
code were in the official tutorial. We should stay away from that pitfall...

Raphaël.
Martin Krauskopf
2007-08-18 06:15:09 UTC
Permalink
Post by Chris Nelson
Cool. It's a plan!
Martin, here's one idea for how we can collaborate. Since test cases
are my favorite kind of documentation, maybe we can us them to help us
get started. Here are some different approaches we could use depending
Good: If your code does not have test cases perhaps I can help write
them and thereby come to an understanding of it.
Better: If there are test cases already, I'll start by reading and
running them and come up to speed that much more quickly.
Best: If you have some failing test cases for code not yet implemented,
I'll start in on trying to make them pass.
This would be the best, I think. Since what I'm starting with is test
cases in ruby-debug itself. But unfortunately there are not too much of
them ($ruby-debug-trunk/test/test-ruby-debug.rb only).
So if you would checkout ruby-debug's trunk and start to write tests
there they would help not only to jruby-debug but also to ruby-debug
itself and to (s|r)ruby-debug implementation in the future
(smalltalk|rubinius) :)
Your testcases would help me also understand all corners of non-C
(ruby-debug-cli) part.

Note that I spent only approximately one week with brute-force rewriting
so I'm happy that I can run the code without zillion of Java/Ruby
exceptions.
I believe that I'll have time next week to take a look at it again.

Also feel free to join whatever subproject in debug-commons. We really
need contributors there ;)

Regards,
m.

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

http://xircles.codehaus.org/manage_email
Chris Nelson
2007-08-18 17:05:06 UTC
Permalink
I'll look at the ruby-debug trunk code and see what I can figure out. I
wasn't clear from your post, are you saying your code is checked into JRuby
trunk now? If so, where? I'm not seeing it.

--Chris
Post by Martin Krauskopf
Post by Chris Nelson
Cool. It's a plan!
Martin, here's one idea for how we can collaborate. Since test cases
are my favorite kind of documentation, maybe we can us them to help us
get started. Here are some different approaches we could use depending
Good: If your code does not have test cases perhaps I can help write
them and thereby come to an understanding of it.
Better: If there are test cases already, I'll start by reading and
running them and come up to speed that much more quickly.
Best: If you have some failing test cases for code not yet implemented,
I'll start in on trying to make them pass.
This would be the best, I think. Since what I'm starting with is test
cases in ruby-debug itself. But unfortunately there are not too much of
them ($ruby-debug-trunk/test/test-ruby-debug.rb only).
So if you would checkout ruby-debug's trunk and start to write tests
there they would help not only to jruby-debug but also to ruby-debug
itself and to (s|r)ruby-debug implementation in the future
(smalltalk|rubinius) :)
Your testcases would help me also understand all corners of non-C
(ruby-debug-cli) part.
Note that I spent only approximately one week with brute-force rewriting
so I'm happy that I can run the code without zillion of Java/Ruby
exceptions.
I believe that I'll have time next week to take a look at it again.
Also feel free to join whatever subproject in debug-commons. We really
need contributors there ;)
Regards,
m.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Martin Krauskopf
2007-08-20 07:02:51 UTC
Permalink
Post by Chris Nelson
I'll look at the ruby-debug trunk code and see what I can figure out. I
wasn't clear from your post, are you saying your code is checked into
JRuby trunk now? If so, where? I'm not seeing it.
The jruby-debug code I have is not checked in anywhere yet. I'm not sure
where the jruby-debug should be maintained in the future. I would prefer
debug-commons (http://debug-commons.rubyforge.org/) since I have full
access there and it is easy to me to add e.g. you as a developer there.
And also jruby-debug is just an extension - not sure whether it should
go into jruby-trunk directly.
In the case of C Ruby it is also developed separately
(http://rubyforge.org/projects/ruby-debug).

Regards,
m.

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

http://xircles.codehaus.org/manage_email
Martin Krauskopf
2007-08-21 05:09:34 UTC
Permalink
Post by Martin Krauskopf
Post by Chris Nelson
I'll look at the ruby-debug trunk code and see what I can figure out.
I wasn't clear from your post, are you saying your code is checked
into JRuby trunk now? If so, where? I'm not seeing it.
The jruby-debug code I have is not checked in anywhere yet. I'm not sure
where the jruby-debug should be maintained in the future. I would prefer
debug-commons (http://debug-commons.rubyforge.org/) since I have full
access there and it is easy to me to add e.g. you as a developer there.
And also jruby-debug is just an extension - not sure whether it should
go into jruby-trunk directly.
In the case of C Ruby it is also developed separately
(http://rubyforge.org/projects/ruby-debug).
Update: yesterday evening I've made pass ruby-debug test. But it's quite
simple, so no big win. Now I'm trying to start up:

jruby .../gemrepo/bin/rdebug simple.rb

Once I get the fast debugger prompt with *very* basic functionality,
I'll commit (probably to debug-commons).
But again the best would be to have more test like:

http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/trunk/test/test-ruby-debug.rb?root=ruby-debug&view=markup

Regards,
m.

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

http://xircles.codehaus.org/manage_email
Chris Nelson
2007-08-21 14:55:54 UTC
Permalink
Hi Martin,

I might have some time to actually work on this stuff tomorrow, any chance
you could share you code in whatever state it's in so I have something to
look at? I'll also play around and see if I can write any useful testcases
for ruby-debug, time permitting.

--Chris
Post by Martin Krauskopf
Post by Martin Krauskopf
Post by Chris Nelson
I'll look at the ruby-debug trunk code and see what I can figure out.
I wasn't clear from your post, are you saying your code is checked
into JRuby trunk now? If so, where? I'm not seeing it.
The jruby-debug code I have is not checked in anywhere yet. I'm not sure
where the jruby-debug should be maintained in the future. I would prefer
debug-commons (http://debug-commons.rubyforge.org/) since I have full
access there and it is easy to me to add e.g. you as a developer there.
And also jruby-debug is just an extension - not sure whether it should
go into jruby-trunk directly.
In the case of C Ruby it is also developed separately
(http://rubyforge.org/projects/ruby-debug).
Update: yesterday evening I've made pass ruby-debug test. But it's quite
jruby .../gemrepo/bin/rdebug simple.rb
Once I get the fast debugger prompt with *very* basic functionality,
I'll commit (probably to debug-commons).
http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/trunk/test/test-ruby-debug.rb?root=ruby-debug&view=markup
Regards,
m.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Martin Krauskopf
2007-09-02 19:00:24 UTC
Permalink
Post by Chris Nelson
Hi Martin,
I might have some time to actually work on this stuff tomorrow, any
chance you could share you code in whatever state it's in so I have
something to look at? I'll also play around and see if I can write any
useful testcases for ruby-debug, time permitting.
Hi Chris,

it's a little bit later than 'tomorrow' ;), but I've committed the code
into debug-commons[1] project. Quoting README there:

====
This is really far from complete. Rather backup and sharing for the
case, someone would like to jump-in in this *very* early stage. A lot of
code is/might_be just wrong. Better to go away and return in few
days/weeks :)

Please contact me at martin.krauskopf-xsfywfwIY+***@public.gmane.org if you would like to
contribute, retake, send patches ... cooperate in whatever manner. See
the 'initiating' thread on the ***@dev mailing list.

http://archive.jruby.codehaus.org/dev/ef98118a0708171132u2bb08358q179a6d29235faadd%40mail.gmail.com
====

So it says all ;) What would tremendously help me in this stage are unit
test for ruby-debug-base (as I wrote already) which is one layer above
the code I'm working on (i.e. unit test written in Ruby). It would also
helped a lot to C ruby-debug team (Kent Sibilev and for some time
already, Rocky Bernstein as I understand it). Since I'm already passing
their test suite, but really simple now.
Currently somehow and sometime is working 'next', 'step' and 'break'
commands for super-simple programs. But that was the worse to reach, I
think. Now I should be able to proceed more quickly, since I learned
basic of JRuby APIs and I'm able to map to it from C Ruby API. Also I
would like to start to understand what the code I'm rewriting actually
does :)
But I do not have too much time these days, since we are approaching
NetBeans 6 Beta 1, which is top priority now. But from time to time I
will work on it (I hope).

Regards,
m.

[1] http://rubyforge.org/projects/debug-commons


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

http://xircles.codehaus.org/manage_email
Charles Oliver Nutter
2007-09-02 19:28:30 UTC
Permalink
Post by Martin Krauskopf
So it says all ;) What would tremendously help me in this stage are unit
test for ruby-debug-base (as I wrote already) which is one layer above
the code I'm working on (i.e. unit test written in Ruby). It would also
helped a lot to C ruby-debug team (Kent Sibilev and for some time
already, Rocky Bernstein as I understand it). Since I'm already passing
their test suite, but really simple now.
Currently somehow and sometime is working 'next', 'step' and 'break'
commands for super-simple programs. But that was the worse to reach, I
think. Now I should be able to proceed more quickly, since I learned
basic of JRuby APIs and I'm able to map to it from C Ruby API. Also I
would like to start to understand what the code I'm rewriting actually
does :)
But I do not have too much time these days, since we are approaching
NetBeans 6 Beta 1, which is top priority now. But from time to time I
will work on it (I hope).
I would officially call on the JRuby community to help out Martin here.
He's got an excellent start, but he's splitting time between getting
jruby-debug and NetBeans out the door...you can guess which takes
priority, and we certainly don't want to impact the excellent work he's
doing on NetBeans.

Martin and others: please keep us posted on any changes necessary in
core. I don't know what else of internal Ruby APIs ruby-debug uses, so I
only ever wired up the event hook logic. If there's something additional
we need to add, let us know.

- Charlie

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

http://xircles.codehaus.org/manage_email

Martin Krauskopf
2007-08-18 05:58:31 UTC
Permalink
Post by Chris Nelson
Hi Martin,
I recognize you from Netbeans Issuezilla :) It's great to hear someone
has already started on this. Sounds I'm starting at the same place you
did: looking at the ruby-debug-base c code and looking for the native
methods we would need to implement in JRuby. Charles, is this headius
branch the stub code you were referring to? It's marked as 0.9.3, is it
still up to date?
Actually I took the Charles' skeleton and put it into the trunk and
started to code there; with using JDK 5 directly, luckily the whole
trunk switched then.
Post by Chris Nelson
Whenever you are ready, I'm happy to look at what you have and see where
I can contribute. It will probably take me a bit to come up to speed,
in looking briefly at the headius branch stub methods I'm pretty much
without a clue as to where the JRuby API code is to implement them. But
I'm willing to learn, any pointers and/or docs would be welcomed.
I think there is no too much docs (but floodgates are opened as Charles
pointed out :) ). So I'm just betting and going through JRuby code.
Sorry for late responses, I'm ill so going to sleep little earlier these
days ;). I'll be probably offline whole week, but... see response to
your next email.

m.


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

http://xircles.codehaus.org/manage_email
Loading...