debug.gem blog: initial commit
Tags: ruby, debugger
Published: 2021-07-31 16:34:03

## About this series of articles

This series introduce features of [ruby/debug: Debugging functionality for Ruby](https://github.com/ruby/debug) now I'm working on. debug.gem will be introduced into Ruby 3.1 which will be released Dec/2021.

This article introduce about debug.gem, the background and the motivation.

BTW see the recent article [A Sneak Peek of Ruby's New Debugger!](https://dev.to/st0012/a-sneak-peek-of-ruby-s-new-debugger-5caa) by @st0012. His great article introduces debug.gem from Ruby on Rails developer perspective.

## Background and motivation

debug.gem is a debugger for Ruby. It is new replacement of [lib/debug.rb](https://docs.ruby-lang.org/en/3.0.0/DEBUGGER__.html) which is installed from ancient Ruby 1.3.1 (!!). However, lib/debug.rb is not maintained well long time and nobody uses it. Surprisingly, most of features works on recent Ruby versions. However, it introduce performance penalties to the application and it lacks important features like flexible breakpoint setting or remote debugging or IDE integration (it can integrate with emacs, though) and so on. Also it doesn't have cosmetic features like coloring.

Maybe byebug ([deivid-rodriguez/byebug: Debugging in Ruby 2](https://github.com/deivid-rodriguez/byebug)) is most famous Ruby's debugger in recent years. byebug has enough features, however it doesn't utilize recent added `TracePoint` features for debuggers, so it is slow when some breakpoint is set.

byebug supports threading. However Ruby 3.0 introduced Ractor ([ruby/ractor.md at master · ruby/ruby](https://github.com/ruby/ruby/blob/master/doc/ractor.md)). Ractor enables to make parallel program in Ruby, but the parallel programming is difficult and it needs support for debugging. However, it is hard to support ractors by existing debuggers.

Hidden but the most important motivation is I (Koichi) likes to make a developer support tools. I feel that using debugger is difficult for the programmers. It is challenging topic to provide useful features for many Rubyists.

## Making a new gem

We talked about replacement plan of lib/debug.rb. Fortunately we can reserve "debug" gem name in rubygem.org so we decided to make a new gem and replace with lib/debug.rb

## Conclusion

This article introduces the background and the motivation of debug.gem.

There is no debugger implementation to utilize MRI's new features for debuggers and no debugger supports Ractors. This is why we decided to make a new debugger.

I really appreciate any feedback about debug.gem. Next I will introduce basic features of debug.gem.

## Acknowledgements

* This work is supported by [Cookpad](https://www.cookpadteam.com/careers), an employer of me (Koichi). In recent months Cookpad allowed me to focus on the debugger development.
* Naoto Ono helps us to prepare testing framework on Google summer of code project ([Ruby | Google Summer of Code](https://summerofcode.withgoogle.com/organizations/4697800446574592/#5080690120458240)).
* [Stan Lo](https://github.com/st0012) contributes appealing features like text coloring and tells us the debugger experience on his projects.
* And all contributors!