Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the debugger with Ruby 2.0?

I know the debugger gem is not and never will be compatible with ruby 2.0 per "officially support ruby 2.X".

In the changelog of Ruby 2.0 is:

Debug support

DTrace support, which enables run-time diagnosis in

production TracePoint, which is an improved tracing API

Is there something out of the box for debugging with Ruby 2.0? Can somebody explain this to me?

like image 962
Intrepidd Avatar asked Mar 04 '13 11:03

Intrepidd


People also ask

How do you use pry in Ruby?

The Ruby programmer can invoke the pry console during runtime by inserting the line 'binding. pry' wherever they would like to stop the program. When the interpreter hits the binding. pry, Pry will open a REPL session in the console, allowing you to test variables, return values, iterations, and more.


1 Answers

The debugger gem can be used but it still has issues.

Install byebug which was written for Ruby 2.0 debugging.

For breakpoints, use the byebug command in your code instead of debugger.

like image 74
Alain Beauvois Avatar answered Oct 04 '22 01:10

Alain Beauvois