Home

Awesome

Status

Status: Maintained until 8/1/15. Accepting bug fixes only

As debugger is only supported for 1.9 and support for 1.9 has ended, debugger will only be maintained until 8/1/15. After this date, this gem will have no more releases. Use of Ruby 2.X is recommended as the Ruby core team has advised.

Description

A fork of ruby-debug(19) that works on 1.9.2 and 1.9.3 and installs easily for rvm/rbenv rubies. ruby >= 2.0 are not supported - see below.

Build Status

Install

$ gem install debugger

# If install fails, try passing headers path
$ gem install debugger -- --with-ruby-include=PATH_TO_HEADERS

For Windows install instructions, see OLD_README.

Supported Rubies

On install, debugger tries to find your ruby's headers. If it's unable to find them and your ruby is a patch release, it will use headers included with debugger-ruby_core_source. For the list of 1.9.X rubies supported by debugger see here. If your ruby is not an official patch release i.e. head, dev or an rc, you are responsible for having headers and setting them with --with-ruby-include.

Usage

Wherever you need a debugger, simply:

require 'debugger'; debugger

To use with bundler, drop in your Gemfile:

gem 'debugger'

Configuration

At initialization time, debugger loads config files, executing their lines as if they were actual commands a user has typed. config files are loaded from two locations:

To see debugger's current settings, use the set command.

Getting Started

After installing the debugger gem, you can create a test file to try out the debugger functionality. Save this example to a file and run it with ruby:

require 'debugger'

x = 4
debugger
y = 5

Running the above code as a file in Ruby (e.g., ruby test-debug.rb) will cause debugger to break code execution and give you an interactive console on the line "debugger". You can type "step" to dive into the line of code or type "next" to stay at the same level and process the line you're on. You can also make any IRB style commands you want to inspect or modify the code. Typing "continue" will resume code execution until the next "debugger" line is encountered, if any.

Using Commands

For a list of commands:

(rdb: 1) help

Most commands are described in rdebug's man page

$ gem install gem-man
$ man rdebug

Remote Debugging

To debug a separate process remotely (such as unicorn) try:

  Debugger.wait_connection = true
  Debugger.start_remote
  debugger

Then you can do

 $ rdebug -c

More documentation

Some thorough documentation of debugger is found with this bashdb tutorial. For emacs and debugger usage, see another bashdb tutorial

Reason for Fork

What's different from ruby-debug19

Issues

Please report them on github.

Known Issues

Contributing

See here for contribution policies. Let's keep this working for the ruby community!

Related projects

Links

License

Licensing due to the complicated forking history of this project. Licensing is BSD throughout most of the repository except for portions of emacs/, doc/ and old_scripts/ which are GPL.

Credits

TODO