RubyMine 2016.3 Release Candidate: Attach to Local Process with Debugger

Hello everyone,

Today we’re glad to bring out the RubyMine 2016.3 RC (build 163.7743.40).

For previous posts covering the major new features of the upcoming release, see: New Gem Management UI, Faster Remote Gem Downloading, Better Puppet Support.

Attach to local process

Starting with v2016.3, RubyMine allows you to attach to locally running Ruby/Rails processes with the IDE’s debugger. The new feature makes it possible to debug an ongoing Ruby/Rails process, whether you are running it from the IDE, terminal, or a custom pipeline.

Imagine having a working Ruby/Rails project with a custom setup. Everything works properly, but there’s some annoying routine affecting your app’s performance. You’d probably want to investigate and fix the issue in that process without having to spend time configuring the debugging environment for the whole project.

You could use Rails autoloader and the newly inserted ‘binding.pry’ to start debugging session in console. However, Attach To Process will go far beyond that, allowing you to exploit the whole feature set of the RubyMine debugger without any configuration.

Just as a trivial example, let’s attach to a Ruby script counting from 1 through 20 with a 3-second delay after every displayed number. The script is run from the terminal:

attach_to_process_run_sample

To attach to this process, in RubyMine, choose Run | Attach to Local Process. The IDE will show all ongoing local Ruby processes. Check the process you want to attach to, and RubyMine will connect the debugger to the specified process:

Note that you don’t need to manually install any debugging gems to attach to process. The IDE will find your Ruby version, the gemset that was defined to run the script, and will install all missing gems automatically.

Once the load is complete, you’ll come across a familiar debugger UI allowing you to use its whole set of features, namely breakpoints, stepping in, variable views, etc. (if you need a refresher on the RubyMine debugger and its functionality, please check the related Help section):

attach_to_process_debugger

You will also be notified on the debugger connection right where you local process is running, e.g. in the terminal:

attach_to_process_notify

_

We’d like to note that we’ll continue working on Attach to Process, in order to provide you with the ability to attach to Ruby/Rails processes located on remote servers, together with other improvements.

Meanwhile, you are welcome to download and try the RC build. If you face any issues using Attach to Process, please report it to our issue tracker.

Should you have any Ruby/Rails-specific use cases that require or are missing convenient debugging for local processes, please share them in the comments below.

_
Your RubyMine Team

This entry was posted in Announcement, Feature, WhatsMining and tagged , . Bookmark the permalink.

4 Responses to RubyMine 2016.3 Release Candidate: Attach to Local Process with Debugger

  1. Pittah Chuckman says:

    Awesome!

    Is it possible to attach to remote running process as well ? Can I attach to production, if needed ?

  2. Pawel says:

    How can you change ruby version to run the debugger with (Attach to local process)? I’m using rbenv, have switched SDK to a new version but Attach to local process still uses the previous version which now doesn’t work. Can’t find any configuration for it :-(

Leave a Reply

Your email address will not be published. Required fields are marked *