Forum: Ruby-core Any documentation about debugging in Ruby 2.0.0

Posted by Rodrigo Rosenfeld Rosas (Guest)
on 2013-02-25 14:22
(Received via mailing list)
Hi, I couldn't find how to debug Ruby 2.0.0 programs, but only a few
mentions about the new DTrace API.

Are there any documentations on debugging for 2.0.0?

Thanks in advance,
Rodrigo.
Posted by Jeremy Kemper (Guest)
on 2013-02-25 14:48
(Received via mailing list)
On Monday, February 25, 2013, Rodrigo Rosenfeld Rosas wrote:

> Hi, I couldn't find how to debug Ruby 2.0.0 programs, but only a few
> mentions about the new DTrace API.
>
> Are there any documentations on debugging for 2.0.0?
>

Check out the new TracePoint API. It needs a debugger interface written 
for
it, though...
Posted by Rodrigo Rosenfeld Rosas (Guest)
on 2013-02-25 16:22
(Received via mailing list)
Em 25-02-2013 10:47, Jeremy Kemper escreveu:
> Check out the new TracePoint API. It needs a debugger interface
> written for it, though...

Ok, thanks for confirming that there is no debugger interface for 2.0.0 
yet.

Best,
Rodrigo.
Posted by Charlie Savage (Guest)
on 2013-02-25 18:08
(Received via mailing list)
The lastest RubyMine version has new debugger for Ruby 2.0 that uses the
tracepoint api.

Charlie
Posted by SASADA Koichi (Guest)
on 2013-02-25 18:35
(Received via mailing list)
(2013/02/26 0:22), Rodrigo Rosenfeld Rosas wrote:
>
> Ok, thanks for confirming that there is no debugger interface for 2.0.0 yet.

Now, I wrote an article ... in Japanese:
http://www.atdot.net/~ko1/diary/201212.html#d18

I'll show you translation with some examples.
... sometime.


----

Advertisement:
I wrote some articles in last 2012, "Ruby VM Advent Calendar".

    #1 Extension of RubyVM::InstructionSequence
    #2 Introduction of Kernel#caller_locations
    #3 Performance of Kernel#caller_locations
    #4 vm_backtrace.c
    #5 Method dispatch performance improvement (RubyConf 2012 slide)
    #6 Introduction of Thread.async_interrupt_timing
    #7 Errata of last day (Thread.async_interrupt_timing)
    #8 Introduction of ObjectSpace.reachable_objects_from()
    #9 Introduction of ObjectSpace::InternalObjectWrapper
    #10 Introduction of Flonum
    #11 Implementation of Flonum
    #12 Introduction of TracePoint (1)
    #13 Introduction of TracePoint (2)
    #14 Introduction of TracePoint (3)
    #15 Introduction of  TracePoint C API
    #16 Implementation of TracePoint
    #17 Introduction of DTrace
    #18 DebugInspector API
    #19 Introduction of Module#prepend
    #20 Application of Module#prepend
    #21 VM Stack size tuning
    #22 Method dispatch performance improvement (1)
    #23 Method dispatch performance improvement (2)
    #24 Method dispatch performance improvement (3)
    #25 Which feature I couldn't implement in Ruby 2.0.0?

Index:
http://www.atdot.net/~ko1/diary/201212.html#d25

I know tenderlove translated some articles (I'm not sure his URLs).
Posted by SASADA Koichi (Guest)
on 2013-02-26 19:29
(Received via mailing list)
(2013/02/26 2:34), SASADA Koichi wrote:
> Now, I wrote an article ... in Japanese:
> http://www.atdot.net/~ko1/diary/201212.html#d18

John Mair made a gem which wraps debug_inspector API described in above
page. Thank you very much!

https://github.com/banister/debug_inspector

Regards,
Koichi
Posted by Rodrigo Rosenfeld Rosas (Guest)
on 2013-02-26 20:22
(Received via mailing list)
Em 26-02-2013 15:14, SASADA Koichi escreveu:
> (2013/02/26 2:34), SASADA Koichi wrote:
>> Now, I wrote an article ... in Japanese:
>> http://www.atdot.net/~ko1/diary/201212.html#d18
> John Mair made a gem which wraps debug_inspector API described in above
> page. Thank you very much!
>
> https://github.com/banister/debug_inspector
>
> Regards,
> Koichi

Thank you, Koichi and John.

Unfortunately I'm too stupid to understand how I use this to debug my
applications... How do I set a breakpoint for instance?
Posted by SASADA Koichi (Guest)
on 2013-02-26 21:25
(Received via mailing list)
(2013/02/27 4:19), Rodrigo Rosenfeld Rosas wrote:
> Unfortunately I'm too stupid to understand how I use this to debug my
> applications... How do I set a breakpoint for instance?

I'm so sorry I completely misunderstood your question.
(how to make a debugger on 2.0.0, i misunderstood)


[ruby-core:52885] check out Charlie's comment (RubyMine).
And debug.rb (in lib) will help.


We introduced some debugger APIs (to make debugger) and I'm not sure
they are used (except RubyMine). I'll try to make one. Sorry for
inconvenience.


Sorry again,
Koichi
Posted by Rodrigo Rosenfeld Rosas (Guest)
on 2013-02-26 21:55
(Received via mailing list)
Em 26-02-2013 17:23, SASADA Koichi escreveu:
> (2013/02/27 4:19), Rodrigo Rosenfeld Rosas wrote:
>> Unfortunately I'm too stupid to understand how I use this to debug my
>> applications... How do I set a breakpoint for instance?
> I'm so sorry I completely misunderstood your question.
> (how to make a debugger on 2.0.0, i misunderstood)
>
>
> [ruby-core:52885] check out Charlie's comment (RubyMine).

I did. I do have a valid (recent) license both for RubyMine and IntelliJ
IDEA, but I just can't remember the last time I used any of those. I'm
too used to Vim to switch :P But at least I know that I can sort to
RubyMine if I have to debug some application. I don't currently have to
debug anything but as I was upgrading my project I was trying to
understand if there was any gem that would replace 'debugger' in my
Gemfile... Sorry for not being clearer about this before.

> And debug.rb (in lib) will help.

I tried that a few days ago but I couldn't find any documentations about
it at that time. Now I think I could find it:

http://www.ruby-doc.org/stdlib-2.0/libdoc/debug/rd...

So my mistake is that I just required 'debug' in the beginning of the
file and couldn't find out how to list the source or add a breakpoint.
But now that I saw the documentation above it seems I have to "require
'debug'" where I want the breakpoint to be, right? :) Okay, better than
nothing :)

> We introduced some debugger APIs (to make debugger) and I'm not sure
> they are used (except RubyMine). I'll try to make one. Sorry for
> inconvenience.

No worries. I really appreciate your efforts on that :) Thank you very 
much!

Cheers,
Rodrigo.
Posted by SASADA Koichi (Guest)
on 2013-03-13 11:51
(Received via mailing list)
I rewrite a debugger for Ruby 2.0.
<https://github.com/ko1/debugger2>

Several features are lacked.
But I want to collect feedback.

Thanks,
Koichi
Posted by mathew (Guest)
on 2013-03-13 18:44
(Received via mailing list)
Maybe other people have more demanding debugger needs, but I've been 
using
Pry, which still works with Ruby 2.0.0p0 as far as I can tell.


mathew
Posted by Rodrigo Rosenfeld Rosas (Guest)
on 2013-03-13 19:22
(Received via mailing list)
Thank you very much, Koichi, but I couldn't get it to work yet:

https://github.com/ko1/debugger2/issues/1

Any hints are appreciated :)

Thanks,
Rodrigo.

Em 13-03-2013 07:50, SASADA Koichi escreveu:
Posted by Rodrigo Rosenfeld Rosas (Guest)
on 2013-03-14 14:48
(Received via mailing list)
I'd just like to let you know that everything seems to be fixed now and
debugger2 from that repository has worked great in the few experiments
I've tried here.

Just use a Gemfile like this:

gem 'debugger2', git: 'debugger2', require: 'debugger'

And write some test code like this:

require 'debugger'

p 1
debugger
p2


Run it with "bundle exec ruby test.rb"

Great job, Koichi! Also, thanks Zach for your help!

Cheers,
Rodrigo.

Em 13-03-2013 15:22, Rodrigo Rosenfeld Rosas escreveu:
Posted by Rodrigo Rosenfeld Rosas (Guest)
on 2013-03-14 14:58
(Received via mailing list)
Em 14-03-2013 10:48, Rodrigo Rosenfeld Rosas escreveu:
> require 'debugger'
>
> p 1
> debugger
> p2

Woops! It should be "p 2", not "p2", of course! :)

Or, if you prefer to run it stand-alone without running through Bundler
command:

test.rb:

require 'bundler'
Bundler.require

p 1
debugger
p 2
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.