Walk the stack in a Pry session
Ruby versions: Branch v0.5 requires Ruby 2.6+. Branch v0.4.11+ will remain for Ruby 2.5 users until its EOL in March 2021.
pry-stack_explorer is a plugin for the Pry REPL that enables the user to navigate the call-stack.
From the point a Pry session is started, the user can move up the stack through parent frames, examine state, and even evaluate code.
ruby-debug, pry-stack_explorer incurs no runtime cost and
enables navigation right up the call-stack to the birth of the
show-stack commands are provided. See
Pry's in-session help for more information on any of these commands.
Provides commands available in Pry sessions.
down- Move up or down the call stack
frame [n]- Go to frame n
show-stack- Show call stack
gem 'pry-stack_explorer', '~> 0.5.0'
gem install pry-stack_explorer
Here we run the following ruby script:
require 'pry-stack_explorer' def alpha x = "hello" beta puts x end def beta binding.pry end alpha
We wander around the stack a little bit, and modify the state of a frame above the one we
Output from above is
Goodbye as we changed the
x local inside the
alpha (caller) stack frame.
- v0.5: Ruby 2.6+, Pry 0.13+
- v0.4.11: Ruby 2.5, Pry 0.12+ (branch
- v0.4.9.3: Older versions
Released under the MIT License by John Mair (banisterfiend) and contributors
Contributions to this gem are released under the same license.