Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to step into with the rails pry debugger?

The pry-debugger is very usefull. It has the following commands :

Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'

However, I dont know how to step into. That is, when a function is called, I want the debugger to open up this function and show me its execution.

How can I do that ?

like image 745
Benjamin Crouzier Avatar asked May 30 '13 07:05

Benjamin Crouzier


People also ask

How do I use pry debugger?

To invoke the debugger, place binding. pry somewhere in your code. When the Ruby interpreter hits that code, execution stops, and you can type in commands to debug the state of the program.

How do I start a pry session?

To start pry, simply type pry after the gem is installed. You can also make it part of your application's dependencies by adding gem "pry" to your application's Gemfile.

How do I go back to the Byebug?

There isn't a step back or undo step command listed on this Pry Cheat Sheet. I would suggest ctrl + c (x2), ctrl + d, the get back into your container and hit the binding pry again.


1 Answers

As you said @deivid, step steps into, while next steps next. I was mistaken.

like image 85
Benjamin Crouzier Avatar answered Oct 20 '22 22:10

Benjamin Crouzier