RubyMine 2017.3 Help

Debugging in Console

In you have once started IRB or Rails console, you've noticed that a temporary run/debug configuration for consoles has been created, and has appeared in the list of available run/debug configurations.

If necessary, you can save this run/debug configuration as a permanent one.

ruby irb console run configuration

This run/debug configuration makes it possible to rerun a console, or launch it in debug mode. Moreover, you can also debug source code from the editor immediately in the console.

To debug source code in a console, follow these general steps

  1. On the main toolbar, click the run/debug configuration selector, and choose a temporary or permanent run/debug configuration for console. Refer to the section Running and Rerunning Applications.
  2. With the desired console run/debug configuration selected, click debug.
    ruby irb console

    The console starts in debug mode.

  3. Make sure that the class you want to debug is opened in the active editor, and breakpoints are set:
    ruby_irb_console_breakpoint
  4. Do one of the following:
    • On the main menu choose Tools | Load File/Selection into IRB/Rails Console.
    • In the console, type the load command, and press Enter:
      load <file name>
    The whole file from the active editor is loaded into the console.
  5. In the Console tab of the debugger, type the name of the method you want to debug:
    ruby debugInConsole1

    Breakpoint is hit:

    ruby_irb_console_breakpoint_hit

    Debug tool window shows the Debugger tab:

    ruby_irb_console_debugger
  6. Proceed through the code, using the stepping toolbar buttons. Explore threads, variables, and watches.
Last modified: 4 April 2018

See Also

Procedures:

Concepts: