On Jun 26, 12:10=A0pm, "Jeremy Kemper" <jer...@bitsweat.net> wrote:
> On Thu, Jun 26, 2008 at 7:12 AM, r <rocky.bernst...@gmail.com> wrote:
> > On Jun 25, 9:24 pm, Jeremy Kemper <jer...@bitsweat.net> wrote:
> >> On Wed, Jun 25, 2008 at 5:55 PM, Roger Pack <rogerpack2...@gmail.com> =
wrote:
> >> > 1.9 lacks profiling and debugging, currently, AFAIK. =A0I knowruby-d=
ebug
> >> > doesn't work on it.
>
> >> The latestruby-debugdoes support 1.9, but it's incomplete yet.
>
> >> jeremy
>
> >ruby-debugdoesn't work in 1.9; my estimate is that it will be a while
> > before it works anywhere well as it does on 1.8.
>
> It does work, but is in, uh, 'alpha' form :) =A0I've been using it for a =
while.
Perhaps you are confusing this with of debug.rb which comes with Ruby
and you invoke via
ruby -rdebug myscript.rb opt1...
ruby-debug is something a bit different -- it's sometimes referred to
as
the "fast" debugger".
The reason ruby-debug doesn't work in Ruby 1.9 is because it hooks
into C API. This API has of necessity drastically changed between 1.8
and 1.9. Furthermore, things that were exposed and available in 1.8
are not yet available in 1.9.
More fundamentally though, 1.9 produces VM instructions and this
imposes a change in the way debugging or tracing works. If you want to
step Ruby statements the code you want to debug has to be "compiled"
for debugging, e.g.:
VM::InstructionSequence.compile_option =3D {
trace_instruction: true
}
Otherwise you can only stop the other events: calls and returns,
exceptions. And even here since 1.9 optimize some calls may be
optimized away. (I read somewhere in a discussion of benchmarks that
it performs tail recursion elimination.)
One way around provide debugging here then is to do it in a slighty
different way which was used on old assembly debuggers and I believe
is used in rubinius. You replace VM instructions you want to stop or
breakpoint at with a call to a handler (e.g. a debugger) and on return
from the handler patch or simulate the instruction that was patched
in.
This nontrivial piece of work is what that the Google 2008 Summer of
Code Student was going to work on.
>
> > A summer student was very interested in making it work on 1.9 via
> > Google 2008 Summer of Code and the Ruby Foundation, but the other
> > mentors and administrator felt there were other projects which were
> > much more important. So that summer student is instead working on
> > another project in Python.
>
> That's too bad. I think it's a very important project.
>
> jeremy