This is mostly a maintenance release. The major change is that ruby-debug has been split in two parts:
ruby-debug-base gem contains the debugger core API written in C. Use this gem if you want to create your own interface to the debugger and don't want to depend on changes to the ruby-debug CLI. The API is considered somewhat stable.
ruby-debug gem depends on ruby-debug-base and provides CLI interface.
The idea is that if you are working on an integration with ruby-debug and find that the command set provided by ruby-debug is too limited for your purposes, you create a new gem and make it depended on ruby-debug-base. The only requirement is that you provide and register Debugger.handler like so:
class MyHandler
def at_line(context, file, line)...
def at_breakoint(context, breakpoint)...
def at_catchpoint(context, exception)...
def at_tracing(context, file, line)...
end
Debugger.handler = MyHandler.new
The handler implements four callback methods that are invoked by the debugger. Each method receives the current context (Debugger::Context) as the first parameters. Please refer to the rdoc bundled with ruby-debug-base gem for the description of debugger API and consider ruby-debug gem as an example of such interface implementation.
One interesting example of such alternative interfaces could be the DBGP protocol that is becoming common in the field of dynamic languages.
Thanks as always for your work on this project. It's saved my ass more than once.
I'm getting an error with this version: 5$ rdebug -sn ./hello.rb
/opt/local/lib/ruby/gems/1.8/gems/ruby-debug-0.8/cli/ruby-debug.rb:21:in
interface=': undefined local variable or methodprocessor' for Debugger:Module (NameError) from /opt/local/lib/ruby/gems/1.8/gems/ruby-debug-0.8/cli/ruby-debug.rb:31:instart_remote' from /opt/local/lib/ruby/gems/1.8/gems/ruby-debug-0.8/bin/rdebug:103 from /opt/local/bin/rdebug:16:inload' from /opt/local/bin/rdebug:16Martin,
Thanks for the bug report. I'm preparing a new version for upload.
When I try to run the following script:
$ cat test.rb
!/usr/bin/env ruby
require 'ruby-debug'
puts 'ok' debugger
I get this error message:
/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.8.1/lib/ruby-debug-base.rb:184:in
current_context': Debugger.start is not called yet. (RuntimeError) from /usr/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.8.1/lib/ruby-debug-base.rb:184:indebugger' from ./test.rb:6Any ideas what I'm doing wrong? Thanks for any help!
Here's my dev environment:
system: 10.4.8 Tiger (Client, with devtools installed)
ruby --version ruby 1.8.5 (2006-08-25) [powerpc-darwin8.7.0]
gem list --local ruby-debug (0.8.1, 0.4.5) Command line interface (CLI) for ruby-debug-base ruby-debug-base (0.8.1) Fast Ruby debugger
I think I figured out what I was doing wrong--full description is here:
http://crasch.livejournal.com/532732.html
Kent, what if you made 'debugger()' automatically call 'Debugger.start()' if the debugger wasn't already started? It would help the people migrating from 'breakpoint'.
evan,
Good idea. I'll change this method in the next version.
Hi, Just a small question: if you use debug_method :method, and you're done, how can you let the program continue ? There should probably a command undebug_method :method, but I haven't found it. Fantastic program, by the way.
Han Holl
Seems that ruby-debug-base breaks when trying to debug ruby 1.8.4 on a 64-bit Linux (Ubuntu Dapper Drake) system.
Here's what I've tried:
Win32 (XP Server): 1.8.4 - ok 1.8.5 - ok 1.8.6 - ok
Linux FedoraCore 6 (32 bit): 1.8.4 - ok 1.8.5 - ok 1.8.6 - ok
Linux Ubuntu DapperDan 64 bit (AMD): 1.8.6 - ok 1.8.4 - fails as below
On an Ubuntu/64 (Dapper Dan) machine running Ruby 1.8.4 I get this error:
Let me outline the code, as I might be doing something dumb here: ================ rdbgp.rb: ================