All Projects → deivid-rodriguez → Pry Byebug

deivid-rodriguez / Pry Byebug

Licence: mit
Step-by-step debugging and stack navigation in Pry

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Pry Byebug

Croissant
🥐 A Lua REPL and debugger
Stars: ✭ 285 (-84.4%)
Mutual labels:  debugger, repl
slyblime
Interactive Lisp IDE with REPL, Inspector, Debugger and more for Sublime Text 4.
Stars: ✭ 35 (-98.08%)
Mutual labels:  debugger, repl
Lua Resty Repl
Interactive console (REPL) for Openresty and luajit code
Stars: ✭ 165 (-90.97%)
Mutual labels:  debugger, repl
Indium
A JavaScript development environment for Emacs
Stars: ✭ 1,058 (-42.09%)
Mutual labels:  debugger, repl
Pry
A runtime developer console and IRB alternative with powerful introspection capabilities.
Stars: ✭ 6,351 (+247.62%)
Mutual labels:  debugger, pry
Byebug
Debugging in Ruby 2
Stars: ✭ 3,202 (+75.26%)
Mutual labels:  debugger, repl
Mond
A scripting language for .NET Core
Stars: ✭ 237 (-87.03%)
Mutual labels:  debugger, repl
Winrepl
x86 and x64 assembly "read-eval-print loop" shell for Windows
Stars: ✭ 424 (-76.79%)
Mutual labels:  debugger, repl
Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (-55.23%)
Mutual labels:  debugger, repl
Gomacro
Interactive Go interpreter and debugger with REPL, Eval, generics and Lisp-like macros
Stars: ✭ 1,784 (-2.35%)
Mutual labels:  debugger, repl
Scout
Scout - Instruction based research debugger (a poor man's debugger)
Stars: ✭ 127 (-93.05%)
Mutual labels:  debugger
Docsh
Erlang Docs in the Shell
Stars: ✭ 127 (-93.05%)
Mutual labels:  repl
Pystlink
Python tool for flashing and debugging STM32 devices using ST-LINK/V2
Stars: ✭ 138 (-92.45%)
Mutual labels:  debugger
Frodo2
Android Library for Logging RxJava2 Components
Stars: ✭ 142 (-92.23%)
Mutual labels:  debugger
Vim Ipython Cell
Seamlessly run Python code in IPython from Vim
Stars: ✭ 127 (-93.05%)
Mutual labels:  repl
Gdb Frontend
☕ GDBFrontend is an easy, flexible and extensionable gui debugger.
Stars: ✭ 2,104 (+15.16%)
Mutual labels:  debugger
Rexbug
A thin Elixir wrapper for the redbug Erlang tracing debugger.
Stars: ✭ 126 (-93.1%)
Mutual labels:  debugger
Vscode Go
Go extension for Visual Studio Code
Stars: ✭ 2,268 (+24.14%)
Mutual labels:  debugger
Apidebugger
A IDEA plug-in to help you easily complete the API debugging.
Stars: ✭ 125 (-93.16%)
Mutual labels:  debugger
Inappviewdebugger
A UIView debugger (like Reveal or Xcode) that can be embedded in an app for on-device view debugging
Stars: ✭ 1,805 (-1.2%)
Mutual labels:  debugger

pry-byebug

Version Build Inline docs Coverage

Adds step-by-step debugging and stack navigation capabilities to pry using byebug.

To use, invoke pry normally. No need to start your script or app differently. Execution will stop in the first statement after your binding.pry.

def some_method
  puts 'Hello World' # Run 'step' in the console to move here
end

binding.pry
some_method          # Execution will stop here.
puts 'Goodbye World' # Run 'next' in the console to move here.

Requirements

MRI 2.4.0 or higher.

Installation

Add

gem 'pry-byebug'

to your Gemfile and run

bundle install

Make sure you include the gem globally or inside the :test group if you plan to use it to debug your tests!

Commands

Step-by-step debugging

break: Manage breakpoints.

step: Step execution into the next line or method. Takes an optional numeric argument to step multiple times.

next: Step over to the next line within the same frame. Also takes an optional numeric argument to step multiple lines.

finish: Execute until current stack frame returns.

continue: Continue program execution and end the Pry session.

Callstack navigation

backtrace: Shows the current stack. You can use the numbers on the left side with the frame command to navigate the stack.

up: Moves the stack frame up. Takes an optional numeric argument to move multiple frames.

down: Moves the stack frame down. Takes an optional numeric argument to move multiple frames.

frame: Moves to a specific frame. Called without arguments will show the current frame.

Matching Byebug Behaviour

If you're coming from Byebug or from Pry-Byebug versions previous to 3.0, you may be lacking the 'n', 's', 'c' and 'f' aliases for the stepping commands. These aliases were removed by default because they usually conflict with scratch variable names. But it's very easy to reenable them if you still want them, just add the following shortcuts to your ~/.pryrc file:

if defined?(PryByebug)
  Pry.commands.alias_command 'c', 'continue'
  Pry.commands.alias_command 's', 'step'
  Pry.commands.alias_command 'n', 'next'
  Pry.commands.alias_command 'f', 'finish'
end

Also, you might find useful as well the repeat the last command by just hitting the Enter key (e.g., with step or next). To achieve that, add this to your ~/.pryrc file:

# Hit Enter to repeat last command
Pry::Commands.command /^$/, "repeat last command" do
  pry_instance.run_command Pry.history.to_a.last
end

Breakpoints

You can set and adjust breakpoints directly from a Pry session using the break command:

break: Set a new breakpoint from a line number in the current file, a file and line number, or a method. Pass an optional expression to create a conditional breakpoint. Edit existing breakpoints via various flags.

Examples:

break SomeClass#run            # Break at the start of `SomeClass#run`.
break Foo#bar if baz?          # Break at `Foo#bar` only if `baz?`.
break app/models/user.rb:15    # Break at line 15 in user.rb.
break 14                       # Break at line 14 in the current file.

break --condition 4 x > 2      # Change condition on breakpoint #4 to 'x > 2'.
break --condition 3            # Remove the condition on breakpoint #3.

break --delete 5               # Delete breakpoint #5.
break --disable-all            # Disable all breakpoints.

break                          # List all breakpoints.
break --show 2                 # Show details about breakpoint #2.

Type break --help from a Pry session to see all available options.

Alternatives

Note that all of the alternatives here are incompatible with pry-byebug. If your platform is supported by pry-byebug, you should remove any of the gems mentioned here if they are present in your Gemfile.

  • pry-debugger: Provides step-by-step debugging for MRI 1.9.3 or older rubies. If you're still using those and need a step-by-step debugger to help with the upgrade, pry-debugger can be handy.

  • pry-stack_explorer: Provides stack navigation capabilities for MRI 1.9.3 or older rubies. If you're still using those and need to navigate your stack to help with the upgrade, pry-stack_explorer can be handy.

  • pry-nav: Provides step-by-step debugging for JRuby.

Contribute

See Getting Started with Development.

Funding

Subscribe to Tidelift to ensure pry-byebug stays actively maintained, and at the same time get licensing assurances and timely security notifications for your open source dependencies.

You can also help pry-byebug by leaving a small (or big) tip through Liberapay.

Security contact information

Please use the Tidelift security contact to report a security vulnerability. Tidelift will coordinate the fix and disclosure.

Credits

  • Gopal Patel (@nixme), creator of pry-debugger, and everybody who contributed to it. pry-byebug is a fork of pry-debugger so it wouldn't exist as it is without those contributions.
  • John Mair (@banister), creator of pry.

Patches and bug reports are welcome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].