Git Product home page Git Product logo

pry-byebug's Introduction

pry-byebug

Version Build Inline docs

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.

pry-byebug's People

Contributors

a-chernykh avatar alisepehri avatar aried3r avatar banister avatar bitdeli-chef avatar bmorearty avatar bouk avatar christian-schulze avatar deivid-rodriguez avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar everm1nd avatar hisas avatar jaredbeck avatar jshou avatar k0kubun avatar lukebergen avatar mtsmfm avatar mvz avatar nixme avatar nviennot avatar olivierlacan avatar palkan avatar printercu avatar rrrene avatar teeparham avatar ttanimichi avatar vsppedro avatar whois-marvin-42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pry-byebug's Issues

Error using step or next

I'm getting the following error when using step or next:

    17:         code
 => 18: binding.pry
    19:         code

[1] myapp(#<Services::Widgets::FillLocale>)> s
undefined method `repl' for nil:NilClass
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:113:in `block in resume_pry'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:19:in `block in run'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:18:in `catch'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:18:in `run'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:112:in `resume_pry'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:80:in `at_line'
/Users/manuel/.rbenv/gems/2.0.0/gems/byebug-2.2.1/lib/byebug/context.rb:74:in `at_line'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:20:in `block in run'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:18:in `catch'
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb:18:in `run'

Exception: NoMethodError: undefined method `repl' for nil:NilClass
--
From: /Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.2.0/lib/pry-byebug/processor.rb @ line 113 @ level: 0 of backtrace (of 71).

    108:       def resume_pry(context)
    109:         new_binding = context.frame_binding(0)
    110:         Byebug.stop unless @always_enabled
    111: 
    112:         run(false) do
 => 113:           @pry.repl new_binding
    114:         end
    115:       end
    116: 
    117:       # Cleanup when debugging is stopped and execution continues.
    118:       def stop

Using Rails 3.2.14, Ruby 2.0.0p247, Pry 0.9.12.2, pry-byebug 1.2.0, byebug 2.2.1

remove n / s / c aliases

Please. These short-cuts are great for a pure debugger, but pry has to be a REPL as well and those single letters are very, very common scratch variables. I get a lot of confused messages from people burnt by these short-cuts.

Putting the code for defining the aliases in the README (like pry-debugger does) is a decent compromise, IMO :)

thanks!

Gemspec has special characters

Hi,

This might be an error with my configuration or the character set that I am using.

I'm having difficulty adding the pry-byebug gem to my Gemfile.
gem "pry-byebug", github: 'deivid-rodriguez/pry-byebug'

There error message was as follows:
There was a SyntaxError while loading pry-byebug.gemspec: /usr/local/rvm/gems/ruby-2.1.2/bundler/gems/pry-byebug-b9353e64ff09/pry-byebug.gemspec:6: invalid multibyte char (US-ASCII) /usr/local/rvm/gems/ruby-2.1.2/bundler/gems/pry-byebug-b9353e64ff09/pry-byebug.gemspec:6: invalid multibyte char (US-ASCII) /usr/local/rvm/gems/ruby-2.1.2/bundler/gems/pry-byebug-b9353e64ff09/pry-byebug.gemspec:6: syntax error, unexpected end-of-input, expecting ']' gem.authors = ['David Rodríguez', 'Gopal Patel']

Please let me know if this is something that should be fixed and sorry in advance if I have the wrong character set :-)

Thanks for your gem! It's awesome.

Thread hangs

See deivid-rodriguez/byebug#115

I have an example repo here: https://github.com/andrewfader/minimal_byebug_hang

bash-3.2$ rspec
hello
Capybara: 2.4.4
capybara-webkit: 1.6.0
Qt: 5.4.2
WebKit: 538.1
QtWebKit: 5.4.2

From: /Users/pivotal/workspace/minimal_byebug_hang_repo/spec/capybara_test_spec.rb @ line 10 :

     5:   describe 'helo' do
     6:     it 'hi' do
     7:       puts "hello"
     8:       puts page.driver.version
     9:       binding.pry
 => 10:       puts 'we aint here'
    11:     end
    12:   end
    13: end

[1] pry(#<RSpec::ExampleGroups::ATest::Helo>)> page.driver.version

commands, aliased or not, overshadow variables

After adding the suggested alias_command to my .pryrc, trying to set any single character aliased command with a space after it, such as in the following
s = 1
generates the following error

Error: Cannot find local context. Did you use binding.pry?

which is the same error one would get with
s
which means that Pry is parsing s = nil as command s with arguments = 1, which is obviously not intended. Removing spaces in the assignment, i.e., s=1 seems to work, but the the value is only accessible via binding.local_variable_get(:s), which is far from convenient.

Maybe this is a Pry parsing limitation, but a workaround is very much desired. At least a warning in the Matching Byebug Behaviour section the README.md is in order.

This issue is a sibling of pry/pry#1490.

Setting breakpoint on method isn't caught

Hi,

I am using pry-rescue and when setting a breakpoint on a method then running try-again the debugger doesn't stop at my breakpoint. A workaround at the moment is to set it to the first line in the method. I don't run into this when using pry-plus probably because it uses pry-debugger and not pry-byebug.

Thanks,
Jay

undefined method `interface' for PryByebug::Processor when using next

I'm getting Rack app error: #<NoMethodError: undefined method 'interface' for #<PryByebug::Processor:0x000000063f2810>> when debugging rails app using pry-byebug upon issuing next in some contexts. Example of this is here: https://gist.github.com/Incanus3/7117126 along with bundle list output. The strange thing is, I don't see any pry calls in the backtrace. I'm using ruby 2.0.0-p247. Can provide more info if you tell me, what's relevant. Thank you. Jakub

binding.pry doesn't fire when it's on the last line of a program

Failing case:

gem install pry-byebug

# test.rb
require 'pry'
binding.pry

Test: ruby test.rb. No pry shell opens.

Passing case:
gem uninstall pry-byebug

Or, add a line with assignment. Oddly enough, ending lines of comments or simply an ending line of 1 doesn't workaround this.

# test.rb
require 'pry'
binding.pry
a = 1

Test: ruby test.rb. The pry shell opens.

The workaround is pretty simple. Ever since moving to ruby 2 and getting rid of pry-nav, I've just got in the habit of doing this. Logging an issue in case this is unexpected. 🍰

Confusing behavior of breaks command

byebug have a commands break and breaks. With break you can delete breakpoint doing this:

break --delete N

After deletion it types list of all remaining breakpoints. But when you type breaks --delete N it does not respect --delete flag and show no error messages. Just typing the same output - list of all available breakpoints. For my it was a little bit confusing. Maybe it's better to throw error or implement --delete flag support for breaks.

pry-stack_explorer compatibility

Frame number: 1/6
Frame type: block

From: /Users/jperry/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-byebug-1.3.0/lib/pry-byebug/processor.rb @ line 21 PryByebug::Processor#run:

    16:     # Wrap a Pry REPL to catch navigational commands and act on them.
    17:     def run(initial = true, &block)
    18:       return_value = nil
    19:
    20:       command = catch(:breakout_nav) do  # Throws from PryByebug::Commands
 => 21:         return_value = yield
    22:         {}    # Nothing thrown == no navigational command
    23:       end
    24:
    25:       times = (command[:times] || 1).to_i   # Command argument
    26:       times = 1 if times <= 0

`break` throws NoMethodError on master

I just installed pry-byebug from master (17f9bc7 specifically) and found the following:

$ pry
2.1.2 (main):0 > require "pry-byebug"
=> false
2.1.2 (main):0 > class Fred; def foo; end; end
=> :foo
2.1.2 (main):0 > break Fred#foo
NoMethodError: undefined method `<<' for nil:NilClass
from /Users/caius/.gem/ruby/2.1.2/gems/byebug-3.2.0/lib/byebug.rb:44:in `add_breakpoint'

The same code works fine on v1.3.3 installed from rubygems.

Threads run in the context of pry/byebug hang in >= 2.0.0

On pry-byebug 1.3.3:

[1] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> x = Thread.new { sleep 0.1; print "x"; print "y"; print "z" } => #<Thread:0x007fbfbb0337c0@(pry):1 sleep> [2] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> x.join xyz=> #<Thread:0x007fbfbb0337c0@(pry):1 dead>

On pry-byebug 2.0.0:
[1] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> x = Thread.new { sleep 0.1; print "x"; print "y"; print "z" } => #<Thread:0x007f807dd83600@(pry):1 sleep> [2] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> x.join
^^ hangs indefinitely

We noticed this while trying to access a connection in capybara-webkit, where threads are used in the connection code: thoughtbot/capybara-webkit#718

Feature Request: Add pry-remote support for finish and continue

Based on Mon-Ouie's comment, the current implementation of finish and continue is incompatible with pry-byebug/pry-debugger since it ends the current pry session.

I see there are several places where in pry-byebug's codebase that attempt to keep compatibility with pry-remote. Is it possible to also support the continue and finish commands?

Unable to quite from code inspect mode

I placed binding.pry inside a pretty long loop and after inspecting two rounds tried to quit with: quit/q!/exit/Ctrl-C/Ctrl-D but there was no use! Help!

Rails console stuck

If I am using spring and pry-byebug then rails console does come up, it just seems to be stuck, I can only ^c out of it and then I get this stack trace :

/Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `gets': Interrupt
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/run.rb:54:in `verify_server_version'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/run.rb:25:in `call'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/rails.rb:23:in `call'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Users/admin/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /Users/admin/code/duplii/bin/spring:16:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

If I remove spring the problem goes away but i'd like to use spring for speed. I am on Rails v4.1.5, pry-byebug v2.0.0 & spring v1.1.3

When use `binding.pry` once, Ruby process get slow.

Hi,

This is a profile before use binding.pry.

before

After use binding.pry and quit it.
Page load time get slow. Webrick's ruby process got slow maybe.

after

Without pry-byebug.
Process does not get slow.

This is Gemfile then. and using ruby 2.2.0.

source 'https://rubygems.org'

gem 'pry-rails'

group :development do
  gem 'rack-mini-profiler'
end

group :test do
  gem 'sqlite3'
end

group :development, :test do
  gem 'pry-byebug'
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  #gem 'spring'
end

pry-byebug not worked directly in $lOAD_PATH.

Because some special reason, I use $LOAD_PATH directly. some gem is not manager by
gem, just directly put into $LOAD_PATH, make it work.

But, from 1.3.2 update to 3.0.1, it not worked for me.

/home/zw963/Dropbox/common/ruby/gems/looksee/core_ext.rb:17:in `method_missing': undefined method `commands' for Pry:Class (NoMethodError)
    from /home/zw963/Dropbox/common/ruby/gems/pry/commands/breakpoint.rb:218:in `<class:Pry>'
    from /home/zw963/Dropbox/common/ruby/gems/pry/commands/breakpoint.rb:9:in `<top (required)>'
    from /home/zw963/Dropbox/common/ruby/gems/pry/commands.rb:5:in `block in <top (required)>'
    from /home/zw963/Dropbox/common/ruby/gems/pry/commands.rb:4:in `each'
    from /home/zw963/Dropbox/common/ruby/gems/pry/commands.rb:4:in `<top (required)>'
    from /home/zw963/Dropbox/common/ruby/gems/pry.rb:145:in `<top (required)>'
    from /home/zw963/.rvm/gems/ruby-2.2.0@neil-rails-app/gems/pry-0.10.1/bin/pry:9:in `<top (required)>'
    from /home/zw963/.rvm/gems/ruby-2.2.0@neil-rails-app/bin/pry:23:in `load'
    from /home/zw963/.rvm/gems/ruby-2.2.0@neil-rails-app/bin/pry:23:in `<main>'
    from /home/zw963/.rvm/gems/ruby-2.2.0@neil-rails-app/bin/ruby_executable_hooks:15:in `eval'
    from /home/zw963/.rvm/gems/ruby-2.2.0@neil-rails-app/bin/ruby_executable_hooks:15:in `<main>'

it caused only by pry-byebug, byebug is work file.

Thanks.

Re-execute command

I really need the ability to re-run a previous line of code during debugging. For example, suppose an exception occurs and a rescue block runs pry. To determine the cause of the exception, I need to jump back up and run the failing line again. But there is no way to do this. We need either a "goto line" command, or a "retry failing code" command.

Any chance of this, please?

it fails to debug raven

Gemfile:

source "https://rubygems.org"
ruby '2.1.5'

gem 'sinatra', git: 'https://github.com/sinatra/sinatra.git', ref: 'b39d72d'
gem 'sentry-raven', '~>0.12.2'
gem 'rspec', '~>3.1.0'
gem 'rack-test', '~>0.6.2'
gem 'pry-byebug', '~>2.0.0'

1.rb:

require 'rubygems'
require 'bundler/setup'

require 'sinatra'
require 'sentry-raven'
require 'pry'

Raven.configure(true) do |config|
  config.dsn = '...'
end

use Raven::Rack

get '/' do
  raise 'test exception'
end

ENV['RACK_ENV'] = 'test'

require 'rack/test'

describe 'app' do
  include Rack::Test::Methods

  def app
    @app || Sinatra::Application
  end

  it 'passes errors to Raven' do
binding.pry
    get '/'
  end
end
$ rspec 1.rb

From: /home/yuri/_/1.rb @ line 31 :

    26:     @app || Sinatra::Application
    27:   end
    28: 
    29:   it 'passes errors to Raven' do
    30: binding.pry
 => 31:     get '/'
    32:   end
    33: end

[2] pry(#<RSpec::ExampleGroups::App>)> break Raven.send
Breakpoint 1: Raven.send (Enabled) :

70: def send(evt)
71:   client.send(evt)
72: end

[3] pry(#<RSpec::ExampleGroups::App>)> c
D, [2015-01-20T23:56:34.280292 #14979] DEBUG -- : ** [Raven] Collecting RuntimeError: test exception
D, [2015-01-20T23:56:34.344399 #14979] DEBUG -- : ** [Raven] Sending event 6ef4ecda3e252a35f01863e9acce5b7f to Sentry
E, [2015-01-20T23:56:34.974403 #14979] ERROR -- : ** [Raven] Unable to record event with remote Sentry server (Raven::Error - Unknown transport scheme '')
E, [2015-01-20T23:56:34.974731 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/client.rb:78:in `transport'
E, [2015-01-20T23:56:34.974868 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/client.rb:37:in `send'
E, [2015-01-20T23:56:34.975025 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:71:in `send'
E, [2015-01-20T23:56:34.975211 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:109:in `block in capture_exception'
E, [2015-01-20T23:56:34.975352 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:136:in `send_or_skip'
E, [2015-01-20T23:56:34.975538 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:103:in `capture_exception'
E, [2015-01-20T23:56:34.975668 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/integrations/rack.rb:29:in `capture_exception'
E, [2015-01-20T23:56:34.975800 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/integrations/rack.rb:66:in `rescue in call'
E, [2015-01-20T23:56:34.975995 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/integrations/rack.rb:60:in `call'
E, [2015-01-20T23:56:34.976125 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
E, [2015-01-20T23:56:34.976256 #14979] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
.

Finished in 40.25 seconds (files took 0.60856 seconds to load)
1 example, 0 failures
$ rspec 1.rb

From: /home/yuri/_/1.rb @ line 31 :

    26:     @app || Sinatra::Application
    27:   end
    28: 
    29:   it 'passes errors to Raven' do
    30: binding.pry
 => 31:     get '/'
    32:   end
    33: end

[1] pry(#<RSpec::ExampleGroups::App>)> $ Raven.send

From: /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb @ line 70:
Owner: #<Class:Raven>
Visibility: public
Number of lines: 4

    def send(evt)
binding.pry
      client.send(evt)
    end
[2] pry(#<RSpec::ExampleGroups::App>)> c
D, [2015-01-21T00:02:58.885132 #15564] DEBUG -- : ** [Raven] Collecting RuntimeError: test exception
before_session hook failed: NoMethodError: undefined method `project=' for :name:Symbol
/home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/client.rb:32:in `send'
(see _pry_.hooks.errors to debug)
[1] pry(Raven)> c

From: /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/logger.rb @ line 13 Raven::Logger#debug:

    12: define_method level do |*args, &block|
 => 13:   msg = args[0] # Block-level default args is a 1.9 feature
    14:   msg ||= block.call if block
    15:   logger = Raven.configuration[:logger]
    16:   logger = ::Logger.new(STDOUT) if logger.nil?
    17: 
    18:   logger.send(level, "#{LOG_PREFIX}#{msg}") if logger
    19: end

[1] pry(#<Raven::Logger>)> c
D, [2015-01-21T00:03:14.147560 #15564] DEBUG -- : ** [Raven] Sending event 8e22243cb2e2b33183a139ac0711fc1e to Sentry
E, [2015-01-21T00:03:14.787366 #15564] ERROR -- : ** [Raven] Unable to record event with remote Sentry server (Raven::Error - Unknown transport scheme '')
E, [2015-01-21T00:03:14.787680 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/client.rb:78:in `transport'
E, [2015-01-21T00:03:14.787837 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/client.rb:37:in `send'
E, [2015-01-21T00:03:14.788014 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:72:in `send'
E, [2015-01-21T00:03:14.788143 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:110:in `block in capture_exception'
E, [2015-01-21T00:03:14.788270 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:137:in `send_or_skip'
E, [2015-01-21T00:03:14.788444 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/base.rb:104:in `capture_exception'
E, [2015-01-21T00:03:14.788572 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/integrations/rack.rb:29:in `capture_exception'
E, [2015-01-21T00:03:14.788710 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/integrations/rack.rb:66:in `rescue in call'
E, [2015-01-21T00:03:14.788883 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/sentry-raven-0.12.2/lib/raven/integrations/rack.rb:60:in `call'
E, [2015-01-21T00:03:14.789010 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
E, [2015-01-21T00:03:14.789138 #15564] ERROR -- : ** [Raven] /home/yuri/.gem/ruby/2.1.5/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
.

Finished in 53.04 seconds (files took 0.60275 seconds to load)
1 example, 0 failures

Pry takes an extremely long time to load when pry-byebug is installed

The following shell session shows:

  1. Installing pry-byebug.
  2. Timing pry -v.
  3. Interrupting pry -v after a few seconds. It hangs for many more seconds and then exits with the stack trace.
  4. Uninstalling pry-byebug.
  5. Timing pry -v.

This is on OS X Mavericks.

$ gem install pry-byebug
Fetching: pry-byebug-1.3.1.gem (100%)
Successfully installed pry-byebug-1.3.1
1 gem installed
$ time pry -v
Pry version 0.9.12.6 on Ruby 2.1.0

real    0m31.586s
user    0m2.022s
sys 0m16.069s
$ pry -v
^C/usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:15:in `block in <module:Byebug>': Interrupt
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:15:in `map'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:15:in `<module:Byebug>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:12:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-byebug-1.3.1/lib/pry-byebug/processor.rb:2:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-byebug-1.3.1/lib/pry-byebug/pry_ext.rb:2:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-byebug-1.3.1/lib/pry-byebug.rb:2:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-byebug-1.3.1/lib/pry-byebug/cli.rb:1:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/plugins.rb:38:in `load_cli_options'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:39:in `block in add_plugin_options'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:38:in `each'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:38:in `add_plugin_options'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:94:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/lib/pry.rb:270:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-0.9.12.6/bin/pry:9:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.0/bin/pry:23:in `load'
    from /usr/local/opt/rbenv/versions/2.1.0/bin/pry:23:in `<main>'
$ time pry -v
Pry version 0.9.12.6 on Ruby 2.1.0

real    0m0.567s
user    0m0.387s

byebug 7.0 support

To resolve #61 on pry processor too, we need byebug 7.0's feature and changes in #80.
Since most of my colleagues use byebug via pry-byebug, I want byebug 7.0 to be supported by pry-byebug.

But pry-byebug's test suite fails with byebug 7.0 and I couldn't easily understand why it's broken.
Is there any hard things to support it?

ArgumentError: uncaught throw :breakout_nav

Hi,

first of all thanks for this gem.

I'm having an issue, I'm debugging a spec, and I call pry with the usual binding.pry at some point.

I get this error when I try to run next or step for the first time, then it jumps to the next call of binding.pry and step / next works properly :

ArgumentError: uncaught throw :breakout_nav
from /Users/Intrepidd/.gem/ruby/2.0.0/gems/pry-byebug-1.0.1/lib/pry-byebug/commands.rb:209:in `throw'

Any Idea on how to fix this ?

Thanks

Please consider reverting 49de00cf89c

This is the "Now pry starts at first line after binding.pry" commit. It's not that this behavior is worse per se, but it violates the expectations of anyone who's already a Pry user and makes it feel like there's an off-by-one bug somewhere. I think pry-byebug probably shouldn't modify the experience of using Pry unless the user specifically opts into it by using one of the debugging commands.

nesting does not work

I see that in vanilla pry if I have binding.pry on some place, it works as a break point. With pry-byebug these are ignored. Is there any way to not ignore them? I see that setting breakpoints dynamically is possible. I tried to set break /home/avalon/v3/lib/tcms/tcms.rb:75, I see proper place in file printed, but execution does not stop.

One specific thing is that I'm not stepping through the code, I'm actually calling methods that go through code with breakpoints. Perhaps different code path.

And one last thing, I can recover to original pry behaviour only after gem uninstall pry-byebug. :require => false does not help and I do not require it anywhere in my files. So I can't have it available when I want it and use vanilla pry when I want that.

Using ruby 2.2.2. And actually I execute cucumber if that matters.

Can't get it to work together with pry-remote

I'm using Pow and use pry-remote to attach to the process and evaluate things. So I needed to navigate through the code and then I added pry-byebug. But when I run next or step commands where binding.remote_pry stops, it takes me to this ensure block from pry-remote, so I think something must be going wrong here... I'm new with the whole pry toolset so sorry if this is not an issue.

Thanks in advance!

Next steps into pry source code

Hello David; thank you in advance!

I am trying to walk through a simple script with pry-byebug to teach my students debugging, but it's not working the way that I expect. Typing next, the progression of lines is 6 => 6 again => 356 in pry_instance.rb. I would have hoped/expected to go from line 6=> 7=> 8 where we could then pause with access to num and idx. I tried a bunch of different versions of pry/pry-byebug/byebug in combination, but they all produce this same result or don't work at all. I also got the same result on a different system. This is under Ruby 2.1.2 on Linux Mint 17 and Ruby 2.1.2 on OSX Yosemite.

Thanks again!
Here's my process:

[david@david-air] ~/Dropbox
❯ pry
[1] pry(main)> load './primes.rb'
=> true
[2] pry(main)> prime?(2)

From: /home/david/Dropbox/primes.rb @ line 6 Object#prime?:

     3: def prime?(num)
     4:   byebug # drops us into the debugger right after this point
     5: 
 =>  6:   (1..num).each do |idx|
     7:     if (num % idx) == 0
     8:       return false
     9:     end
    10:   end
    11: end

[1] pry(main)> next

From: /home/david/Dropbox/primes.rb @ line 6 Object#prime?:

     3: def prime?(num)
     4:   byebug # drops us into the debugger right after this point
     5: 
 =>  6:   (1..num).each do |idx|
     7:     if (num % idx) == 0
     8:       return false
     9:     end
    10:   end
    11: end

[1] pry(main)> next
Next went up a frame because previous frame finished

From: /home/david/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb @ line 356 Pry#evaluate_ruby:

    351: def evaluate_ruby(code)
    352:   inject_sticky_locals!
    353:   exec_hook :before_eval, code, self
    354: 
    355:   result = current_binding.eval(code, Pry.eval_path, Pry.current_line)
 => 356:   set_last_result(result, code)
    357: ensure
    358:   update_input_history(code)
    359:   exec_hook :after_eval, result, self
    360: end

[1] pry(#<Pry>)> 

Segmentation Fault ```ARObject.valid?```

I'm not sure where to start looking for crash logs when it comes to this, but here is what I'm using and an output of my pry-shell. Can you point me in the direction of what else you need to reproduce this?

using:

  • Yosemite 10.10.3
  • ruby 2.2.2
  • rspec 3.3.2
  • mysql 0.3.18
  • pry-byebug 3.2.0
  • pry 0.10.2
[1] pry(#<FirmsController>)> @firm
=> #<Firm:0x000000043c3828
 id: 2,
 firm_id: "executing-firm-id-1",
 email: nil,
 created_at: Tue, 06 Oct 2015 15:34:55 UTC +00:00,
 updated_at: Tue, 06 Oct 2015 15:34:55 UTC +00:00>

[2] pry(#<FirmsController>)> Firm.count
=> 1

[3] pry(#<FirmsController>)> @firm.valid?
Segmentation fault
[vagrant@localhost vagrant]$

Feature to set alias for `binding.pry`

I'm a bit uncomfortable with having to type binding.pry every time.
There's a gem kentaroi/pry-alias for making an alias for binding.pry.
Isn't it a nice idea to embed this feature in pry-byebug? Giving an option to set whatever alias name in .pryrc or something/

Cannot identify arguments as breakpoint error when using --show

Hi,

I get the following error when running:

break --show 1
ArgumentError: Cannot identify arguments as breakpoint
from /usr/local/opt/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-byebug-1.3.2/lib/pry-byebug/commands.rb:174:in `new_break
point'

Thanks in advance!

Issue with pry-byebug 1.3.0

Hi,

I'm experiencing an issue after upgrading pry-byebug to 1.3.0, with both Rails 3/4 and Ruby 2.0/2.1 on OSX 10.9

user in ~/dev/testpry $ rails s
/Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug/processor.rb:5:in `<module:PryByebug>': uninitialized constant Byebug::Processor (NameError)
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug/processor.rb:4:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug/pry_ext.rb:2:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug/pry_ext.rb:2:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug.rb:2:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug.rb:2:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug/cli.rb:1:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-byebug-1.3.0/lib/pry-byebug/cli.rb:1:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry/plugins.rb:38:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry/plugins.rb:38:in `load_cli_options'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:39:in `block in add_plugin_options'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:38:in `each'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:38:in `add_plugin_options'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry/cli.rb:94:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry.rb:270:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/pry-0.9.12.6/lib/pry.rb:270:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/commands/repl.rb:106:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/commands/repl.rb:106:in `<module:Byebug>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/commands/repl.rb:50:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/command.rb:85:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/command.rb:85:in `block in load_commands'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/command.rb:84:in `each'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/command.rb:84:in `load_commands'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/command.rb:207:in `<module:Byebug>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/command.rb:5:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/processor.rb:3:in `require_relative'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug/processor.rb:3:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug.rb:4:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/byebug-2.5.0/lib/byebug.rb:4:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/user/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
    from /Users/user/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/user/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
    from /Users/user/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
    from /Users/user/dev/testpry/config/application.rb:12:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
    from /Users/user/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

in order to reproduce:

$ rails new testpry --skip-active-record

add the following to the gemfile and run bundle

group :development, :test do
  gem 'byebug'
  gem 'pry'
  gem 'pry-byebug'
end

if I use gem 'pry-byebug', '1.2.1' everything is fine

`break` & `next` don't work inside blocks

; pry
>> for i in 0..5                                                                          
 |   if i > 2 then                                                                        
 |     break                                                                              
 |   end                                                                                  
 |   puts "Value of local variable is #{i}"                                               
 | end                                                                                    
Value of local variable is 0
Value of local variable is 1
Value of local variable is 2
Value of local variable is 3
Value of local variable is 4
Value of local variable is 5
=> 0..5

After uninstalling pry-byebug, it works.

Pry version 0.10.1 on Ruby 2.1.4
pry-byebug 2.0.0

pry-byebug causes blocking of test rails server

Repo that reproduces issue

Summary

When pry-byebug is added to this project's gem file and binding.pry is used within a feature test (RSpec or Cucumber with Capybara) the web thread/process waits on the binding.pry even if that breakpoint is located in the test file. When pry-byebug is removed, the web thread/process is not blocked and the user may click around around if they are using a non-headless browser (Selenium w/ Firefox in this case).

Steps to Reproduce

  1. Clone this repo.
  2. bundle
  3. rake db:create
  4. rspec spec/features/users/sign_in_spec.rb:11
  5. When the break point is reached, attempt to click a link to a new page.

Expected Result

The server is able to handle the request and renders the page.

Actual Result

The server hangs waiting on the binding.pry call.

  1. Continue on from the breakpoint.
  2. Remove gem 'pry-byebug' from the gem file.
  3. rspec spec/features/users/sign_in_spec.rb:11
  4. When the break point is reached, attempt to click a link to a new page.

Actual Result

The server does not wait on the binding.pry call.

Is this intended behavior? Maybe this is related to #69?

What does `next' means? Thanks.

Exist following code

require 'pry-byebug'; binding.pry

for e in 1..10
  puts 'hello'
end

When use next, pry-byebug not into for loop, but pry-debugger, or byebug, rdebug, all
will into for loop.

Another problem:

require 'pry-byebug'; binding.pry

for e in (1..10)
  puts 'hello'
end

when use next, relation to previous example, this example need one more time
to invoke next, why ?

Thanks.

one more things:
Here exist a discuss about byebug better work together pry.
pry/pry#1192
I hope you could consider what we discuss, thanks.

Pry 0.10.0 Support

I'm currently getting conflicts with pry-byebug and the new pry 0.10.0 release. Would it be possible to update the gemspec to to support the latest release of Pry? As a workaround, I've had to lock Pry at 0.9.12 in order to resolve the conflict.

break does not list breakpoints

I'm using version 3.1.0 and adding breakpoints by line number:-

break 14 # => output shown to say that break point has been enabled
break #=> no output shown

When running break --disable-all it displays the previous assigned breakpoint as being disabled

Could not gem install pry-byebug on RVM >= 2.0

Hi there,

I tried install pry-byebug. And I got the following:

192-168-182-129:byebug-3.5.1 andywong$ gem installl pry-debug
ERROR:  While executing gem ... (Gem::CommandLineError)
Unknown command installl
192-168-182-129:byebug-3.5.1 andywong$ gem install pry-byebug
Building native extensions.  This could take a while...    
ERROR:  Error installing pry-byebug:
ERROR: Failed to build gem native extension.

/Users/andywong/.rvm/rubies/ruby-2.1.3/bin/ruby extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling breakpoint.c 
make: I.: No such file or directory
make: [breakpoint.o] Error 1 (ignored)
compiling byebug.c
make: I.: No such file or directory
make: [byebug.o] Error 1 (ignored)
compiling context.c
make: I.: No such file or directory
make: [context.o] Error 1 (ignored)
compiling locker.c
make: I.: No such file or directory
make: [locker.o] Error 1 (ignored)
compiling threads.c
make: I.: No such file or directory
make: [threads.o] Error 1 (ignored)
linking shared-object byebug/byebug.bundle
make: dynamic: No such file or directory
make: [byebug.bundle] Error 1 (ignored)

make "DESTDIR=" install
compiling breakpoint.c
make: I.: No such file or directory
make: [breakpoint.o] Error 1 (ignored)
compiling byebug.c
make: I.: No such file or directory
make: [byebug.o] Error 1 (ignored)
compiling context.c
make: I.: No such file or directory
make: [context.o] Error 1 (ignored)
compiling locker.c
make: I.: No such file or directory
make: [locker.o] Error 1 (ignored)
compiling threads.c
make: I.: No such file or directory
make: [threads.o] Error 1 (ignored)
linking shared-object byebug/byebug.bundle
make: dynamic: No such file or directory
make: [byebug.bundle] Error 1 (ignored)
/usr/bin/install -m 0755 byebug.bundle ./.gem.20141201-1025-10y7n3v/byebug
install: byebug.bundle: No such file or directory
make: *** [install-so] Error 71

make install failed, exit code 2

Gem files will remain installed in /Users/andywong/.rvm/gems/ruby-2.1.3/gems/byebug-3.5.1 for inspection.
Results logged to /Users/andywong/.rvm/gems/ruby-2.1.3/extensions/x86_64-darwin-14/2.1.0-static/byebug-3.5.1/gem_make.out

My version rvm is the following:
ruby-2.1.3

Any advice, what I need to do to troubleshoot this?

Thanks.

Bump version

Any plans here to bump the next version so updating to new byebug version will be possible (without adding git(hub) repo to the Gemfile)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.