rubyprybyebug

Adding blackboxed libraries to Pry debugging


Is it possible to "blackbox" libraries when using Pry?

I like to walk the stack when I hit a breakpoint, but I really don't care about active-record transactions management and such. In fact, it even makes walking the stack completely useless sometimes.

In javascript, it's easy to add scripts to an ignore list and they are just skipped during debugging. Is there a way to achieve a similar behavior with Pry?

Additionnal details

What i mean by stack walk, is using "up" to move to the calling source code line which moves the source code marker to the previous stack frame.

I want to ignore frames that are outside my own code, like ActiveRecord and most third-party gems. I don't mind using either a blacklist or a whitelist.

Bundle gives me these gem versions:

Using byebug 9.0.6
Using pry 0.12.2
Using pry-byebug 3.4.3

Solution

  • The requested functionality does not exist in pry-byebug. You can add your +1 (or write some code) on the following GitHub issue for pry-byebug:

    My question/suggestion is that if there's a way to filter or skip over external library, or a setting to step into the next line that belongs to a script within the current application. For example, step into a method call will skip over any Rails's internal script or any currently-used gem and stop at the next line of the file that's inside the application.

    As well as this GitHub issue:

    I think it would be super useful to have a command that lets you run until you hit the next line of non-Rails/non-gem code.

    As the original issue has been open for nearly six years, I think your best bet will be to help build the feature vs. adding a +1 on the existing issues.

    The author of pry-byebug also offers this workaround in another SO answer to a very similar question:

    you need to manually set breakpoints to jump from controller to view and the other way around