Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails and Byebug - How can I re-display the current line context

Tags:

When I'm debugging with Byebug sometimes I evaluate some variables in the terminal which causes the displayed line context to 'go up'. Then I would like to print it again to screen. How can I do that?

I thought maybe 'display' will do that but apparently it does something else.

like image 744
Eyal Levin Avatar asked Nov 26 '13 16:11

Eyal Levin


People also ask

How to exit from byebug?

To exit byebug , use the quit command (abbreviated to q ). Normally, if you are in an interactive session, this command will prompt to ask if you really want to quit. If you want to quit without being prompted, enter quit unconditionally (abbreviated to q! ).

How to step in byebug?

Starting Byebug If you're running Byebug on a Rails application in development mode, you no longer need to start the server with --debugger – the debugger is on by default. To get going, simply type byebug (or debugger ) into your source file at the line you're interested in and run the program.

What is Byebug?

Byebug is a Ruby debugger. It's implemented using the TracePoint C API for execution control and the Debug Inspector C API for call stack navigation. The core component provides support that front-ends can build on.


1 Answers

I think you're looking for list = which basically shows you where you are in the same manner as when you first drop into the debugger (by default - you can turn autolist off).

There are a few different options for the list command. list = centres the display around the current line. Without the = it will show the next 10 lines.

like image 79
Shadwell Avatar answered Sep 16 '22 14:09

Shadwell