开发者

How to debug Ruby base methods in Netbeans?

开发者 https://www.devze.com 2023-01-01 03:03 出处:网络
I am able to debug my ruby program. At times, I would want to go inside the library methods and see what is happening. How to achieve it in Ruby.

I am able to debug my ruby program. At times, I would want to go inside the library methods and see what is happening. How to achieve it in Ruby.

For example,

[ 3, 1, 7, 0 ].sort

i would want to go inside the sort method and see how that works lively. In Java+Eclipse this is possible, all I have to do is to attach the source of Foundation classes in Eclipse. Is it possible in Ruby with N开发者_高级运维etbeans as IDE?

Thanks


For those methods which are implemented in Ruby, the debugger will just step into them.

For those methods which are not implemented in Ruby, i.e. they are implemented in C in MRI, YARV and tinyrb, in Java in JRuby and XRuby, in C# in IronRuby and Ruby.NET, in Smalltalk in MagLev and SmallRuby, in ABAP in BlueRuby, in Go in RubyGoLightly, in C++ in Rubinius or in Objective-C in MacRuby, the NetBeans Ruby plugin contains a stub method that only lists the method signature and the RDoc comments, but not the actual implementation.

The NetBeans Ruby debugger is, after all, a Ruby debugger, it doesn't know how to step into C, C++, Objective-C, C#, Smalltalk, ABAP or Java.

It would probably be possible to somehow link together the Ruby debugger with, say, the C++ debugger (provided that you have installed the NetBeans C++ plugin), but nobody has done that work yet.

In your specific case, in almost all Ruby implementations, Array#sort is not implemented in Ruby. The only exception is probably Rubinius, but I don't know whether Rubinius is supported by the NetBeans Ruby plugin (I use Windows and Rubinius isn't supported on Windows).

0

精彩评论

暂无评论...
验证码 换一张
取 消