Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby debug is stepping into rather than stepping over

I am writing a Rails 4 application in Ruby 2, and I am using the debugger gem to debug my code.

Here is the situation currently:

I place a debugger statement in my Rspec tests, run the tests in the shell, and the program breaks as expected. Wishing to step to the next line, I enter n, but the debugger actually steps into the code, showing me the inner workings of libraries I don't care to see.

So the issue is, the debugger command n is acting like s.

How can I solve this problem*?

*I am not willing to put a breakpoint on the next line and then continue, that will get very old, very fast.

like image 719
codysehl Avatar asked Jun 30 '13 15:06

codysehl


People also ask

What is step over and step into in debugging?

Step Into: Step Into is used for debugging the test steps line by line. When the procedure gets called, Step Into enables you to get inside the procedure and debugs the procedure steps line by line. Step Over: Step Over will enable, only after the debugging is started with Step Into / Run From Step / Run to Step.

How do I step through Ruby code?

Force step over Steps over the current line of code and takes you to the next line even if the highlighted line has method calls in it. If there are breakpoints in the called methods, they are ignored. From the main menu, select Run | Force Step Over or press Alt+Shift+F8 .

What does it mean to step into or step out of a function?

"Step into" will stop on the first executable line inside the function. Note, if you have optimisation enabled, the "first executable line" may not be the one you expect. 8/15/2021. 1and0. There is also a "Step Out" allowing you to step out of a function which you are currently stepping through.

Can you debug Ruby in Vscode?

Go to the debugger view of VS Code and hit the gear icon. Choose Ruby or Ruby Debugger from the prompt window, then you'll get the sample launch config in . vscode/launch.


1 Answers

Debugger does not yet fully support Ruby 2.0, and one of the issues is that next incorrectly acts like step. You’ll have to wait till the issue is fixed for it to work correctly, or use an alternative debugger such as Byebug.

like image 100
Andrew Marshall Avatar answered Oct 27 '22 12:10

Andrew Marshall