Coder Social home page Coder Social logo

pry-debugger's Introduction

Using MRI 2.0.0+? Use pry-byebug.


pry-debugger Bitdeli Badge

Fast execution control in Pry

Adds step, next, finish, and continue commands and breakpoints to Pry using debugger.

To use, invoke pry normally. No need to start your script or app differently.

def some_method
  binding.pry          # Execution will stop here.
  puts 'Hello World'   # Run 'step' or 'next' in the console to move here.
end

For a complete debugging environment, add pry-stack_explorer for call-stack frame navigation.

Execution Commands

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.

Breakpoints

You can set and adjust breakpoints directly from a Pry session using the following commands:

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. (Same as `breakpoints`)
break --show 2                 Show details about breakpoint #2.

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

breakpoints: List all defined breakpoints. Pass -v or --verbose to see the source code around each breakpoint.

Caveats

pry-debugger is not yet thread-safe, so only use in single-threaded environments.

Only supports MRI 1.9.2 and 1.9.3. For a pure ruby approach not reliant on debugger, check out pry-nav. Note: pry-nav and pry-debugger cannot be loaded together.

Remote debugging

Support for pry-remote (>= 0.1.4) is also included. Requires explicity requiring pry-debugger, not just relying on pry's plugin loader.

Want to debug a Rails app running inside foreman? Add to your Gemfile:

gem 'pry'
gem 'pry-remote'
gem 'pry-stack_explorer'
gem 'pry-debugger'

Then add binding.remote_pry where you want to pause:

class UsersController < ApplicationController
  def index
    binding.remote_pry
    ...
  end
end

Load a page that triggers the code. Connect to the session:

$ bundle exec pry-remote

Using Pry with Rails? Check out Jazz Hands.

Tips

Stepping through code often? Add the following shortcuts to ~/.pryrc:

if defined?(PryDebugger)
  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

Contributors

  • Gopal Patel (@nixme)
  • John Mair (@banister)
  • Nicolas Viennot (@nviennot)
  • Benjamin R. Haskell (@benizi)
  • Joshua Hou (@jshou)
  • ...and others who helped with pry-nav

Patches and bug reports are welcome. Just send a pull request or file an issue. Project changelog.

pry-debugger's People

Contributors

arnab avatar banister avatar jshou avatar nixme avatar nviennot avatar rking 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

pry-debugger's Issues

Ruby 2.0 dependencies

debugger-ruby_core_source 1.2.0 was released for compatibility with ruby-2.0.0-p0.

pry-debugger currently depends on debugger-ruby_core_source (~> 1.1.2)

Next command is leaving current stack frame

when I hit next (or n) it should "Step over to the next line within the same frame" but when I hit next a few times it leaves the current frame and jumps into activerecord source. This happens under MRI 1.9.3 and 2.0.0

here's the recording: http://showterm.io/b3f3cd8e525b69d803e98

other relevant stuff. it's a skeleton rails app with 1 model and these gems:

# Gemfile (stock rails 4 + pry stuff)
source 'https://rubygems.org'

gem 'rails', '4.1.5'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'spring', group: :development

gem 'pry'
gem 'pry-stack_explorer'
gem 'pry-debugger'

# Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.1.5)
      actionpack (= 4.1.5)
      actionview (= 4.1.5)
      mail (~> 2.5.4)
    actionpack (4.1.5)
      actionview (= 4.1.5)
      activesupport (= 4.1.5)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.5)
      activesupport (= 4.1.5)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.5)
      activesupport (= 4.1.5)
      builder (~> 3.1)
    activerecord (4.1.5)
      activemodel (= 4.1.5)
      activesupport (= 4.1.5)
      arel (~> 5.0.0)
    activesupport (4.1.5)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    arel (5.0.1.20140414130214)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    builder (3.2.2)
    coderay (1.1.0)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.3.0)
      coffee-script-source
      execjs
    coffee-script-source (1.7.1)
    columnize (0.8.9)
    debug_inspector (0.0.2)
    debugger (1.6.8)
      columnize (>= 0.3.1)
      debugger-linecache (~> 1.2.0)
      debugger-ruby_core_source (~> 1.3.5)
    debugger-linecache (1.2.0)
    debugger-ruby_core_source (1.3.5)
    erubis (2.7.0)
    execjs (2.2.1)
    hike (1.2.3)
    i18n (0.6.11)
    jbuilder (2.1.3)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (3.1.1)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.8.2)
    mime-types (1.25.1)
    minitest (5.4.0)
    multi_json (1.10.1)
    polyglot (0.3.5)
    pry (0.10.1)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-debugger (0.2.3)
      debugger (~> 1.3)
      pry (>= 0.9.10, < 0.11.0)
    pry-stack_explorer (0.4.9.1)
      binding_of_caller (>= 0.7)
      pry (>= 0.9.11)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.1.5)
      actionmailer (= 4.1.5)
      actionpack (= 4.1.5)
      actionview (= 4.1.5)
      activemodel (= 4.1.5)
      activerecord (= 4.1.5)
      activesupport (= 4.1.5)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.5)
      sprockets-rails (~> 2.0)
    railties (4.1.5)
      actionpack (= 4.1.5)
      activesupport (= 4.1.5)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.3.2)
    rdoc (4.1.1)
      json (~> 1.4)
    sass (3.2.19)
    sass-rails (4.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.0)
      sprockets (~> 2.8, <= 2.11.0)
      sprockets-rails (~> 2.0)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    slop (3.6.0)
    spring (1.1.3)
    sprockets (2.11.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.1.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    sqlite3 (1.3.9)
    thor (0.19.1)
    thread_safe (0.3.4)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (2.2.3)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.5.3)
      execjs (>= 0.3.0)
      json (>= 1.8.0)

PLATFORMS
  ruby

DEPENDENCIES
  coffee-rails (~> 4.0.0)
  jbuilder (~> 2.0)
  jquery-rails
  pry
  pry-debugger
  pry-stack_explorer
  rails (= 4.1.5)
  sass-rails (~> 4.0.3)
  sdoc (~> 0.4.0)
  spring
  sqlite3
  turbolinks
  uglifier (>= 1.3.0)

# The only model
class Book < ActiveRecord::Base
  def authors_of_books_with_similar_length
    binding.pry
    books = Book.where('page_length BETWEEN ? AND ?', page_length - 10, page_length + 10)
    books.map(&:author)
  end

  def self.seed_books
    Book.create(title: 'title', author: 'author', page_length: 135)
    Book.create(title: 'title2', author: 'some guy', page_length: 135)
    Book.create(title: 'crazy long book', author: 'some guy', page_length: 340)
  end
end

next keyword hijacked in loop

Howdy, I've encountered an issue where the next keyword is being hijacked and can no longer skip iterations using the next keyword. I assume this is also happening for continue, etc.

Example:

pry(main)> [1,2,3].collect do |v|
pry(main)*   next if v == 2  
Error: Cannot find local context. Did you use `binding.pry`?
pry(main)*   v
pry(main)* end  
=> [1, 2, 3]

binding.pry has not been called in the pry console or during the execution of the application, so I don't know why this is happening.

How do I stop this?

Ruby version: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Rails version: Rails 3.2.20

`continue` command exits Pry session

Is there a specific reason for this? When I have multiple binding.remote_pry lines set, it's pretty annoying to have to c out of them, and start up pry-remote again just to get to the next debug point.

break --show doesn't work

break shows I have 1 breakpoint but break --show 1 gives the following error:

Error: The method '--show' could not be found. Type `break --help` for help.

I'm on Rails 4.0.3 and have pry-rails and pry-debugger in my Gemfile.

debugger-linecache fails to build under Rubinius 2.0 (dcd08)

Commenting out 'pry-debugger' gem solved this issue so I'm just documenting this here. This is the output I was getting:

Didn't have time to investigate further, but I did see 'rbx-linecache' in rubygems, maybe it's as simple as using that dependency when running on rubinius.

Noting that debugger-linecache is a dependency of debugger and not pry-debugger.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /opt/rbx-2.0.0-rc1/bin/rbx extconf.rb 
checking for vm_core.h... no
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/opt/rbx-2.0.0-rc1/bin/rbx
    --with-ruby-dir
    --without-ruby-dir
    --with-ruby-include
    --without-ruby-include=${ruby-dir}/include
    --with-ruby-lib
    --without-ruby-lib=${ruby-dir}/lib


Gem files will remain installed in /opt/rbx-2.0.0-rc1/gems/1.9/gems/debugger-linecache-1.1.2 for inspection.
Results logged to /opt/rbx-2.0.0-rc1/gems/1.9/gems/debugger-linecache-1.1.2/ext/trace_nums/gem_make.out

An error occurred while installing debugger-linecache (1.1.2), and Bundler cannot continue.
Make sure that `gem install debugger-linecache -v '1.1.2'` succeeds before bundling.

Thanks

next working as step

I have installed pry-debugger with pry-rails. When using binding.pry, the next command is working as the step command. I am using pry version 0.9.12.6 and pry-debugger 0.2.2

'exit' when debugging in REPL puts pry into a broken state

Note the -1 prompt ([6] (pry) : -1>) which indicates an empty binding_stack

crow:pry-debugger john$ ruby o.rb 

Frame number: 0/1
Frame type: eval

From: o.rb @ line 24 :

    19: def boink
    20:   x = 30
    21:   puts "hi"
    22: end
    23: 
 => 24: binding.pry

[1] (pry) main: 0> break my
Breakpoint 1: o.rb @ line 7 (Enabled) :

     4:   puts "hi"
     5: end
     6: 
 =>  7: def my
     8:   puts "hey there"
     9:   pig
    10: end

[2] (pry) main: 0> my

Breakpoint 1. First hit.
resume_pry: changing binding to #<Binding:0x007fedda447800>

Frame number: 0/1
Frame type: eval

From: o.rb @ line 7 Object#my:

 =>  7: def my
     8:   puts "hey there"
     9:   pig
    10: end

[3] (pry) main: 0> exit
hey there
putty
hi
=> nil
[5] (pry) : -1> cat o.rb
require 'pry'

def love
  puts "hi"
end

def my
  puts "hey there"
  pig
end

def pig
  x = 10
  y = 30
  puts "putty"
  boink
end

def boink
  x = 30
  puts "hi"
end

binding.pry
[6] (pry) : -1> 

'break' command doesn't work on methods defined inside pry

[11] (pry) main: 0> def little_pig
[11] (pry) main: 0*   1
[11] (pry) main: 0*   2
[11] (pry) main: 0*   3
[11] (pry) main: 0* end  
=> nil
[12] (pry) main: 0> break little_pig
ArgumentError: Invalid file!
from /Users/john/.rvm/gems/ruby-1.9.3-p194/gems/pry-debugger-0.2.0/lib/pry-debugger/breakpoints.rb:13:in `add'
[13] (pry) main: 0> 

Reuse pry instance

Don't call Pry.start for every new break. Just re-use the starting one.

According to @banister, replace the binding_stack of that pry instance and we should be all set. See how pry-stack_explorer does it.

Also look into calling Debugger.stop on continue.

Finish does not return to where `step` was called

How do I finish all the way back to the context where I called step from in the first place? It seems like calling finish takes me to unknown parts of the pry. For example,

user = User.first
break user.some_method
user.some_method
next
step # Step into first line of User#some_method
finish

I expect the finish command at the end to take me back to the the User#some_method context. But instead, it takes me to line 329 of /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/pry-0.9.12.6/lib/pry/pry_instance.rb.

Is there something I'm missing about the finish command? Is there a way to return to the context that I first called step in?

backtrace come out in large quantities in and pry + rcodetools have pry-debugger

$ gem uninstall pry pry-debugger rcodetools

$ gem i pry rcodetools
Successfully installed pry-0.9.12
Successfully installed rcodetools-0.8.5.0

$ echo "require 'pry'; :ok # =>" > a.rb

$ ruby -S xmpfilter a.rb
require 'pry'; :ok # => :ok

$ gem i pry-debugger
Successfully installed pry-debugger-0.2.1

$ ruby -S xmpfilter a.rb
require 'pry'; :ok # => :ok
# ~>    from -:1:in `<main>'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-0.9.12/lib/pry.rb:267:in `<top (required)>'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-0.9.12/lib/pry/cli.rb:94:in `<top (required)>'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-0.9.12/lib/pry/cli.rb:38:in `add_plugin_options'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-0.9.12/lib/pry/cli.rb:38:in `each'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-0.9.12/lib/pry/cli.rb:39:in `block in add_plugin_options'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-0.9.12/lib/pry/plugins.rb:38:in `load_cli_options'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-debugger-0.2.1/lib/pry-debugger/cli.rb:14:in `<top (required)>'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
# ~>    from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-debugger-0.2.1/lib/pry-debugger/pry_ext.rb:1:in `<top (required)>'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
# ~>    from /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
# ~> /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-debugger-0.2.1/lib/pry-debugger/processor.rb:100: warning: (...) interpreted as grouped expression
# ~> /usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58: warning: loading in progress, circular require considered harmful - /usr/local/rvm/gems/ruby-1.9.3-p286/gems/pry-0.9.12/lib/pry.rb
(snip)

I do not know whether there is cause pry, rcodetools, the pry-debugger, which library. However, because they trace back I'm getting lots of pry-debugger is present, I posted here. I saved backtrace will not come out with.

License issue

pry-debugger depends on debugger (licensed as GPL 2).
We should adjust the license of pry-debugger to GPL to reflect that or find a replacement dependency instead of debugger.
What do you think we should do?

malloc: possible integer overflow (ArgumentError)

Environment

ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]
Pry version 0.9.12.1 on Ruby 1.9.3

Steps to reproduce

gem install pry-debugger
pry

Output.

Fetching: debugger-ruby_core_source-1.2.0.gem (100%)
Fetching: debugger-linecache-1.2.0.gem (100%)
Fetching: debugger-1.5.0.gem (100%)
Building native extensions.  This could take a while...
Fetching: pry-debugger-0.2.2.gem (100%)
Successfully installed debugger-ruby_core_source-1.2.0
Successfully installed debugger-linecache-1.2.0
Successfully installed debugger-1.5.0
Successfully installed pry-debugger-0.2.2
4 gems installed
/opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': malloc: possible integer overflow (ArgumentError)
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/debugger-1.5.0/lib/ruby-debug-base.rb:1:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/debugger-1.5.0/lib/ruby-debug.rb:5:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/debugger-1.5.0/lib/debugger.rb:4:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-debugger-0.2.2/lib/pry-debugger/processor.rb:2:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-debugger-0.2.2/lib/pry-debugger/pry_ext.rb:2:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-debugger-0.2.2/lib/pry-debugger/cli.rb:14:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-0.9.12.1/lib/pry/plugins.rb:38:in `load_cli_options'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-0.9.12.1/lib/pry/cli.rb:39:in `block in add_plugin_options'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-0.9.12.1/lib/pry/cli.rb:38:in `each'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-0.9.12.1/lib/pry/cli.rb:38:in `add_plugin_options'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-0.9.12.1/lib/pry/cli.rb:94:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-0.9.12.1/lib/pry.rb:267:in `<top (required)>'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/curacao/.gem/ruby/1.9.3/gems/pry-0.9.12.1/bin/pry:9:in `<top (required)>'
        from /home/curacao/.gem/ruby/1.9.3/bin/pry:23:in `load'
        from /home/curacao/.gem/ruby/1.9.3/bin/pry:23:in `<main>'

Additional information

With the older version of Pry Debugger everything works fine.

gem install pry-debugger -v 0.2.1

Thread safety

Shouldn't be too bad since Debugger includes threading support.

jruby 1.7.2 cannot install pry-debugger gem

using jruby 1.7.2
running on ubuntu 12.04 64bit.

jruby -S gem install pry-debugger

Building native extensions. This could take a while...
ERROR: Error installing pry-debugger:
ERROR: Failed to build gem native extension.

    /opt/jruby-1.7.2/bin/jruby extconf.rb

NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

(root) at /opt/jruby-1.7.2/lib/ruby/shared/mkmf.rb:8
require at org/jruby/RubyKernel.java:1027
(root) at /opt/jruby-1.7.2/lib/ruby/shared/rubygems/custom_require.rb:1
(root) at extconf.rb:1

Gem files will remain installed in /opt/jruby-1.7.2/lib/ruby/gems/shared/gems/debugger-linecache-1.1.2 for inspection.
Results logged to /opt/jruby-1.7.2/lib/ruby/gems/shared/gems/debugger-linecache-1.1.2/ext/trace_nums/gem_make.out
16:16:38:(2),jobs=0,cmd#=2,hist#=1081
root@wt-lanai[~]

cat /opt/jruby-1.7.2/lib/ruby/gems/shared/gems/debugger-linecache-1.1.2/ext/trace_nums/gem_make.out

/opt/jruby-1.7.2/bin/jruby extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

(root) at /opt/jruby-1.7.2/lib/ruby/shared/mkmf.rb:8
require at org/jruby/RubyKernel.java:1027
(root) at /opt/jruby-1.7.2/lib/ruby/shared/rubygems/custom_require.rb:1
(root) at extconf.rb:1

Failed compiling for Ruby2.0.0p0 x64 under windows

C:\Legacy\Ruby200-x64\bin>gem install pry-debugger
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing pry-debugger:
ERROR: Failed to build gem native extension.

C:/Legacy/Ruby200-x64/bin/ruby.exe extconf.rb

checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... yes
checking for vm_core.h... yes
checking for iseq.h... yes
checking for insns.inc... yes
checking for insns_info.inc... yes
checking for eval_intern.h... yes
checking for struct iseq_line_info_entry in vm_core.h,iseq.h... yes
checking for if rb_iseq_compile_with_option was added an argument filepath... yes
creating Makefile

make
generating ruby_debug-x64-mingw32.def
compiling breakpoint.c
compiling ruby_debug.c
ruby_debug.c:27:19: error: conflicting types for 'rb_iseq_compile_with_option'
In file included from ruby_debug.c:4:0:
C:/Legacy/Ruby200-x64/lib/ruby/gems/2.0.0/gems/debugger-ruby_core_source-1.2.0/lib/debugger/ruby_core_source/ruby-2.0.0-p0/vm_core.h:646:7: note: previous declaration of 'rb_iseq_compile_with_option' was here
ruby_debug.c: In function 'save_call_frame':
ruby_debug.c:493:31: warning: operation on 'debug_context->frames' may be undefined [-Wsequence-point]
ruby_debug.c:506:53: error: 'rb_control_frame_t' has no member named 'bp'
ruby_debug.c: In function 'set_thread_event_flag_i':
ruby_debug.c:698:7: error: 'rb_thread_t' has no member named 'event_flags'
ruby_debug.c:698:24: error: 'RUBY_EVENT_VM' undeclared (first use in this function)
ruby_debug.c:698:24: note: each undeclared identifier is reported only once for each function it appears in
ruby_debug.c: In function 'debug_event_hook':
ruby_debug.c:727:16: error: 'ID_ALLOCATOR' undeclared (first use in this function)
ruby_debug.c:780:96: error: 'rb_control_frame_t' has no member named 'bp'
ruby_debug.c:952:102: error: 'rb_control_frame_t' has no member named 'bp'
ruby_debug.c: In function 'context_frame_id':
ruby_debug.c:1756:8: warning: unused variable 'id' [-Wunused-variable]
ruby_debug.c: In function 'context_frame_file':
ruby_debug.c:1823:45: error: 'rb_iseq_t' has no member named 'filename'
ruby_debug.c: In function 'copy_scalar_args':
ruby_debug.c:1861:24: error: 'rb_control_frame_t' has no member named 'dfp'
ruby_debug.c: In function 'context_copy_locals':
ruby_debug.c:1922:46: error: 'rb_control_frame_t' has no member named 'dfp'
ruby_debug.c:1940:62: error: 'rb_control_frame_t' has no member named 'dfp'
ruby_debug.c: In function 'context_jump':
ruby_debug.c:2407:63: error: 'rb_iseq_t' has no member named 'filename'
ruby_debug.c:2409:38: error: 'rb_iseq_t' has no member named 'insn_info_size'
ruby_debug.c:2411:30: error: 'rb_iseq_t' has no member named 'insn_info_table'
ruby_debug.c:2422:56: error: 'rb_iseq_t' has no member named 'insn_info_table'
In file included from ruby_debug.c:9:0:
ruby_debug.c: At top level:
C:/Legacy/Ruby200-x64/lib/ruby/gems/2.0.0/gems/debugger-ruby_core_source-1.2.0/lib/debugger/ruby_core_source/ruby-2.0.0-p0/insns_info.inc:695:1: warning: 'insn_name' defined but not used [-Wunused-function]
C:/Legacy/Ruby200-x64/lib/ruby/gems/2.0.0/gems/debugger-ruby_core_source-1.2.0/lib/debugger/ruby_core_source/ruby-2.0.0-p0/insns_info.inc:701:1: warning: 'insn_op_types' defined but not used [-Wunused-function]
C:/Legacy/Ruby200-x64/lib/ruby/gems/2.0.0/gems/debugger-ruby_core_source-1.2.0/lib/debugger/ruby_core_source/ruby-2.0.0-p0/insns_info.inc:707:1: warning: 'insn_op_type' defined but not used [-Wunused-function]
ruby_debug.c: In function 'context_frame_file':
ruby_debug.c:1824:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [ruby_debug.o] Error 1

Gem files will remain installed in C:/Legacy/Ruby200-x64/lib/ruby/gems/2.0.0/gems/debugger-1.2.4 for inspection.
Results logged to C:/Legacy/Ruby200-x64/lib/ruby/gems/2.0.0/gems/debugger-1.2.4/ext/ruby_debug/gem_make.out

next and step seems to works as same

Hello,

When I'm using pry-debugger, in a rails application, I have this :

    9: def new
   10:   painting.address = current_user.address
   11:   painting.postal_code = current_user.postal_code
   12:   binding.pry
=> 13:   painting.city = current_user.city
   14:   painting.country = current_user.country
   15:   painting.phone = current_user.phone
   16: end

If I understand, when I type "next", it should go to the line 14 but it go here :

    47: def painting
 => 48:   @painting
    49: end

It is on the same file so it can be normal but, If I type "next" again I go to another file.

Is there something wrong?

Thanks!

'next' navigates into pry-debugger/processor.rb code

I am using ruby 1.9.3-p194 with:
pry (0.9.12)
pry-debugger (0.2.2)

When I add a "binding.pry" breakpoint and execute my code, execution stops and displays the surrounding code, as expected. However, if I type 'next', I am taken here:

From: /Users/alex/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pry-debugger-0.2.2/lib/pry-debugger/processor.rb @ line 19 PryDebugger::Processor#run:


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

Navigation had been working recently, so I am unsure if a bundle update is causing this or if there is a particular change in my own code that is triggering it. My .pryrc is:

Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'

I'll keep poking around to see if I can make it work with simpler code.

Cheers,

Alex

next does not work (windows)

next command is supposed to step to the next line. However, I have had several instances where it just continues execution and does not stop at the next line. I'm running this on a windows box so this could be specific to windows.

Feature Request: Need a Way to Try Next Line

When I'm halted at a breakpoint, right before the line where I suspect my code may throw an exception, I OFTEN find myself leaving the keyboard to copy the next line with the mouse, paste it in, and hit "Enter"

The goal of this is to try the next line of code without being forced out of Ruby if the line throws an exception. The capability is already there via cut and paste. But what would really make Pry a KILLER APP for me is if there were a command like

try-next

That does exactly that for me--runs the next line of code wiithout forcing me out of Ruby if it breaks.

Unable to install with ruby version 2.1.4

hi,

I can't seem to install pry-debugger with ruby 2.1.4. Downgrading to 2.0.0 helps. This is on Kubuntu 14.04. Here's what I'm getting:

Installing debugger-ruby_core_source 1.3.7

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/jonyt/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20141202-9696-11gyj8z.rb extconf.rb 
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/jonyt/.rvm/rubies/ruby-2.1.4/bin/ruby
/home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1401:in `initialize': No such file or directory @ rb_sysopen - ./214/ruby_debug.h (Errno::ENOENT)
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1401:in `open'
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1401:in `copy_file'
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:483:in `copy_file'
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:400:in `block in cp'
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1579:in `block in fu_each_src_dest'
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1593:in `fu_each_src_dest0'
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1577:in `fu_each_src_dest'
    from /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
    from extconf.rb:83:in `block in <main>'
    from extconf.rb:82:in `each'
    from extconf.rb:82:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/debugger-1.6.8 for inspection.
Results logged to /home/jonyt/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/debugger-1.6.8/gem_make.out
An error occurred while installing debugger (1.6.8), and Bundler cannot
continue.
Make sure that `gem install debugger -v '1.6.8'` succeeds before bundling.

Pry-debugger won't install on MRI 2.1.0-preview2

On MRI 2.1.0-preview2, doing 'gem install pry-debugger' gives:

ERROR:  Error installing pry-debugger:
        ERROR: Failed to build gem native extension.
    /home/mydir/.rbenv/versions/2.1.0-preview2/bin/ruby extconf.rb
Ruby version 2.1.0 is not supported.

OK - so it says right there that 2.1.0 is not supported. But it should be! :-)

Work with debugger-pry

Looks like pry-debugger's trampling of debugger's CommandProcesser screws up debugger-pry.

next erroneously behaves like step [MRI 2.0]

for a few weeks now - quite possibly since switching to Ruby 2.0 - next has been behaving like step, which is obviously rather annoying

minimal test case:

$ cat Gemfile
source :rubygems

gem 'pry'
gem 'pry-debugger'

$ cat foo.rb
def foo
  require 'pry'; binding.pry
  puts "FOO"
  bar
  baz
end

def bar
  puts "BAR"
end

def baz
  puts "BAZ"
end

foo

$ bundle exec ruby foo.rb

using next there steps into both bar and baz - I'd expect it to step over those and remain inside foo though

(tested with pry v0.9.12.1 and pry-debugger v0.2.2 on Ruby v2.0.0p0)

How can you tell where in the code you are, when stepping through?

Being used to GUI debuggers in IDEs, I feel very lost when stepping through code, without actually being able to see my code, alongside a helpful arrow that says "You are here".

I can't find any way to actually show the area of code around where I currently am. What am I missing?

Release a patch version that works with Pry v0.10

Hi there!

Pry v0.10 has been released for a while, and there is already a patch that allows pry-debugger to run together with Pry v0.10, see: c3abfc4

Is it possible to release a patch version (0.2.3), so that we all can upgrade to Pry v0.10?

Fails to install on Ruby 2.1.2p95: Failed to build gem native extension

Installing debugger-linecache 1.2.0
Installing debugger-ruby_core_source 1.3.2

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /.rbenv/versions/2.1.2/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/.rbenv/versions/2.1.2/bin/ruby
/.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `stat': No such file or directory @ rb_file_s_stat - ./212/ruby_debug.h (Errno::ENOENT)
        from /.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `block in fu_each_src_dest'
        from /.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1587:in `fu_each_src_dest0'
        from /.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1571:in `fu_each_src_dest'
        from /.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
        from extconf.rb:83:in `block in <main>'
        from extconf.rb:82:in `each'
        from extconf.rb:82:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /vendor/bundler/gems/debugger-1.6.6 for inspection.
Results logged to /vendor/bundler/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.6/gem_make.out
An error occurred while installing debugger (1.6.6), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.6.6'` succeeds before bundling.

`break --condition` doesn't parse right

It appears that the break --condition command does not work:

[1] pry(main)> RUBY_VERSION
=> "1.9.3"
[2] pry(main)> Pry::VERSION
=> "0.9.12.2"
[3] pry(main)> break foo.rb:3
Breakpoint 1: /Users/sharpie/foo.rb @ line 3 (Enabled) :

    1: x=2
    2: 
 => 3: puts x

[4] pry(main)> break --condition 1 x == 2
Error: The method '--condition' could not be found. Type `break --help` for help.

Is there something wrong with the way I am passing the flag?

pry won't start on 1.9.3-p392

~  gem install pry-debugger                                                                                                                                    
Fetching: pry-debugger-0.2.1.gem (100%)
Successfully installed pry-debugger-0.2.1
1 gem installed
Installing ri documentation for pry-debugger-0.2.1...
Building YARD (yri) index for pry-debugger-0.2.1...
Installing RDoc documentation for pry-debugger-0.2.1...
leaf ➜  ~  pry                                                                                                                                                         /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:11: warning: already initialized constant DEFAULT_HOOKS
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:17: warning: already initialized constant DEFAULT_PRINT
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:55: warning: already initialized constant SIMPLE_PRINT
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:64: warning: already initialized constant CLIPPED_PRINT
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:69: warning: already initialized constant DEFAULT_EXCEPTION_HANDLER
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:78: warning: already initialized constant DEFAULT_PROMPT_NAME
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:81: warning: already initialized constant DEFAULT_PROMPT
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:92: warning: already initialized constant SIMPLE_PROMPT
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:94: warning: already initialized constant SHELL_PROMPT
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:101: warning: already initialized constant NAV_PROMPT
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:116: warning: already initialized constant DEFAULT_CONTROL_D_HANDLER
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:132: warning: already initialized constant DEFAULT_SYSTEM
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:140: warning: already initialized constant INITIAL_PWD
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:185: warning: already initialized constant DEFAULT_EXCEPTION_WHITELIST
/Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry/cli.rb:7: warning: already initialized constant NoOptionsError
/Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': cannot load such file -- trace_nums (LoadError)
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/debugger-linecache-1.1.2/lib/tracelines19.rb:3:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/debugger-linecache-1.1.2/lib/linecache19.rb:65:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/debugger-1.2.4/lib/ruby-debug-base.rb:2:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/debugger-1.2.4/lib/ruby-debug.rb:5:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/debugger-1.2.4/lib/debugger.rb:4:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-debugger-0.2.1/lib/pry-debugger/processor.rb:2:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-debugger-0.2.1/lib/pry-debugger/pry_ext.rb:2:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-debugger-0.2.1/lib/pry-debugger/cli.rb:14:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry/plugins.rb:38:in `load_cli_options'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry/cli.rb:39:in `block in add_plugin_options'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry/cli.rb:38:in `each'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry/cli.rb:38:in `add_plugin_options'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry/cli.rb:94:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/lib/pry.rb:267:in `<top (required)>'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/bin/pry:12:in `rescue in <top (required)>'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/gems/pry-0.9.12/bin/pry:8:in `<top (required)>'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/bin/pry:19:in `load'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/bin/pry:19:in `<main>'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/ivan/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
leaf ➜  ~  gem uninstall pry-debugger                                                                                                                                  18:31 ivan
Successfully uninstalled pry-debugger-0.2.1
leaf ➜  ~  pry                                                                                                                                                         18:32 ivan
[1] pry(main)>

debugger not work

breakpoint stop and not show code and methods not avaliable

[5] pry(CompanyDeleter)> ls
NoMethodError: undefined method term' for ["ls", :ident]:CodeRay::Tokens from /home/semen/.rvm/gems/ruby-1.9.3-p429@pulscen/gems/coderay-1.0.8/lib/coderay/tokens.rb:83:inrescue in method_missing'

Confusing behavior of `n`, terminating a Rails console

source 'https://rubygems.org'

ruby '2.0.0'

gem 'rails'
gem 'sqlite3'

group :development, :test do
  gem 'pry-debugger'
end
$ rails c
Loading development environment (Rails 4.1.4)
2.0.0-p353 :001 > n
/tmp/n-wat$ 

This deserved an animated GIF.

rails-c

It's either confusing or a bug?

Breakpoints

Declare via:

break-point MyClass#method
break-point file:line

nested breakpoints dont work

when a breakpoint is hit, and debugging has started, adding another breakpoint for a method and then invoking that method does not break on the method

[1] (pry) main: 0> break fizzbuzz
Breakpoint 1: /Users/john/ruby/projects/pry-autopilot/examples/example5.rb @ line 43 (Enabled) :

    40: end
    41: 
    42: 
 => 43: def fizzbuzz(x, y)
    44:   k = 0
    45:   k = 1
    46:   k = 2

[2] (pry) main: 0> fizzbuzz 1, 2

Breakpoint 1. First hit.
[3] (pry) main: 0> whereami

Frame number: 0/1
Frame type: eval

From: /Users/john/ruby/projects/pry-autopilot/examples/example5.rb @ line 43 Object#fizzbuzz:

 => 43: def fizzbuzz(x, y)
    44:   k = 0
    45:   k = 1
    46:   k = 2
    47:   @i = 0
    48:   1.upto(13) { |i| @i = i }
    49: end

[4] (pry) main: 0> break trick
Breakpoint 2: /Users/john/ruby/projects/pry-autopilot/examples/example5.rb @ line 51 (Enabled) :

    48:   1.upto(13) { |i| @i = i }
    49: end
    50: 
 => 51: def trick
    52:   1
    53:   v = 30
    54:   y = 20

[5] (pry) main: 0> trick
=> 20
[6] (pry) main: 0> 

I cannot type an 'o', 'p', or 'v' inside the pry-debugger.

This is a baffling situation that makes use of variable names and the continue method very difficult. I've been a user of the pry debugger for a long time and terminal corruption and this sort of thing occasionally happens (like when Unicorn reaps the debugger session, or two debugger sessions end up on top of each other like with multiple capistrano hosts), but not to the point of unusability like this.

Sometimes the 'o' shows up after typing it three times, then I get an o^? and can safely delete the ^?. But this time around, I can't type an o to save my life.

I am using pry-debugger 0.2.3 trying to debug Capistrano scripts, if that helps.

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.