byebug 0,2,0,0,2,0,2,1 rubocop travis-ci ruby Rubygems

Debugging in Ruby 2

2 years after BSD-2-Clause

Byebug

Version Quality Coverage Gratipay Gitter

Byebug is a simple to use, feature rich debugger for Ruby 2. It uses the new TracePoint API for execution control and the new Debug Inspector API for call stack navigation, so it doesn't depend on internal core sources. It's developed as a C extension, so it's fast. And it has a full test suite so it's reliable.

It allows you to see what is going on inside a Ruby program while it executes and offers many of the traditional debugging features such as:

  • Stepping: Running your program one line at a time.
  • Breaking: Pausing the program at some event or specified instruction, to examine the current state.
  • Evaluating: Basic REPL functionality, although pry does a better job at that.
  • Tracking: Keeping track of the different values of your variables or the different lines executed by your program.

Build Status

Linux Tra

Windows Vey

Requirements

  • Required: MRI 2.0.0 or higher. For debugging ruby 1.9.3 or older, use debugger.
  • Recommended:
    • MRI 2.1.8 or higher.
    • MRI 2.2.4 or higher.
    • MRI 2.3.0 or higher.
    • MRI 2.4.0 or higher.

Install

gem install byebug

Usage

From within the Ruby code

Simply drop

byebug

wherever you want to start debugging and the execution will stop there. If you were debugging Rails, for example, you would add byebug to your code.

def index
  byebug
  @articles = Article.find_recent
end

And then start a Rails server.

bin/rails s

Once the execution gets to your byebug command you will get a debugging prompt.

From the command line

If you want to debug a Ruby script without editing it, you can invoke byebug from the command line.

byebug myscript.rb

Byebug's commands

Command     | Aliases      | Subcommands
----------- |:------------ |:-----------
`backtrace` | `bt` `where` |
`break`     |              |
`catch`     |              |
`condition` |              |
`continue`  |              |
`delete`    |              |
`debug`     |              |
`disable`   |              | `breakpoints` `display`
`display`   |              |
`down`      |              |
`edit`      |              |
`enable`    |              | `breakpoints` `display`
`finish`    |              |
`frame`     |              |
`help`      |              |
`history`   |              |
`info`      |              | `args` `breakpoints` `catch` `display` `file` `line` `program`
`irb`       |              |
`kill`      |              |
`list`      |              |
`method`    |              | `instance`
`next`      |              |
`pry`       |              |
`quit`      |              |
`restart`   |              |
`save`      |              |
`set`       |              | `autoirb` `autolist` `autopry` `autosave` `basename` `callstyle` `fullpath` `histfile` `histsize` `linetrace` `listsize` `post_mortem` `savefile` `stack_on_error` `width`
`show`      |              | `autoirb` `autolist` `autopry` `autosave` `basename` `callstyle` `fullpath` `histfile` `histsize` `linetrace` `listsize` `post_mortem` `savefile` `stack_on_error` `width`
`source`    |              |
`step`      |              |
`thread`    |              | `current` `list` `resume` `stop` `switch`
`tracevar`  |              |
`undisplay` |              |
`up`        |              |
`var`       |              | `all` `constant` `global` `instance` `local`

Semantic Versioning

Byebug tries to follow semantic versioning and tries to bump major version only when backwards incompatible changes are released. Backwards compatibility is targeted to pry-byebug and any other plugins relying on byebug.

Getting Started

Read byebug's markdown guide to get started. Proper documentation will be eventually written.

Related projects

  • pry-byebug adds next, step, finish, continue and break commands to pry using byebug.
  • ruby-debug-passenger adds a rake task that restarts Passenger with Byebug connected.
  • minitest-byebug starts a byebug session on minitest failures.
  • sublime_debugger provides a plugin for ruby debugging on Sublime Text.
  • atom-byebug provides integration with the Atom editor [EXPERIMENTAL].

Contribute

See Getting Started with Development.

Credits

Everybody who has ever contributed to this forked and reforked piece of software, especially:

  • @ko1, author of the awesome TracePoint API for Ruby.
  • @cldwalker, debugger's maintainer.
  • @denofevil, author of debase, the starting point of this.
  • @kevjames3 for testing, bug reports and the interest in the project.
  • @FooBarWidget for working and helping with remote debugging.

Related Repositories

awesome-ruby

awesome-ruby

:gem: A collection of awesome Ruby libraries, tools, frameworks and software ...

awesome-rails-gem

awesome-rails-gem

A collection of awesome Ruby Gems for Rails development. ...

pry-byebug

pry-byebug

Step-by-step debugging and stack navigation in Pry ...

rails4-starterkit

rails4-starterkit

Rails 4.1 starter app with production ready performance, security, and authentic ...

minitest-byebug

minitest-byebug

Start a byebug session on test failures. ...


Top Contributors

deivid-rodriguez eric-hu os97673 k0kubun x-yuri astashov yui-knk shuky19 FooBarWidget eagletmt jonatack bquorning edward arthurnn windwiny guilherme HookyQR andreychernih cben bitdeli-chef bouk abatko ChrisMissal emilebosch fabien-michel amatsuda hlindberg igorfrenkel jamtur01 jm3

Releases

-   v9.0.5 zip tar
-   v9.0.4 zip tar
-   v9.0.3 zip tar
-   v9.0.2 zip tar
-   v9.0.1 zip tar
-   v9.0.0 zip tar
-   v8.2.5 zip tar
-   v8.2.4 zip tar
-   v8.2.3 zip tar
-   v8.2.2 zip tar
-   v8.2.1 zip tar
-   v8.2.0 zip tar
-   v8.1.0 zip tar
-   v8.0.1 zip tar
-   v8.0.0 zip tar
-   v7.0.0 zip tar
-   v6.0.2 zip tar
-   v6.0.1 zip tar
-   v6.0.0 zip tar
-   v5.0.0 zip tar
-   v4.0.5 zip tar
-   v4.0.4 zip tar
-   v4.0.3 zip tar
-   v4.0.2 zip tar
-   v4.0.1 zip tar
-   v4.0.0 zip tar
-   v3.5.1 zip tar
-   v3.5.0 zip tar
-   v3.4.2 zip tar
-   v3.4.1 zip tar