nixme / pry-nav

Binding navigation commands for Pry to make a simple debugger
MIT License
390 stars 35 forks source link

'next' steps into Pry code after done with app code #11

Closed sent-hil closed 8 years ago

sent-hil commented 12 years ago
From: /Users/senthil/Documents/Developer/play/archived/single/debugger.rb @ line 9 in Post#initialize:

     4: class Post
     5:   def initialize
     6:     binding.pry
     7: 
     8:     puts 'before'
 =>  9:     puts 'after'
    10:   end
    11: end

[1] pry(#<Post>)> next
after

From: /Users/senthil/.rvm/gems/ruby-1.9.3-p0-perf/gems/pry-0.9.8.4/lib/pry/default_commands/cd.rb @ line 53 in cd#process:

    48:               output.puts e.inspect
    49:               return
    50:             end
    51:           end
    52: 
 => 53:           _pry_.binding_stack = stack
    54:         end
    55:       end
    56:     end
    57:   end
    58: end

[1] pry(#<#<Class:0x007f9b52b99390>>)> next

From: /Users/senthil/.rvm/gems/ruby-1.9.3-p0-perf/gems/pry-0.9.8.4/lib/pry/command.rb @ line 372 in #<class(Pry::Command nil)>#call_with_hooks:

    367:         instance_exec(*args, &block)
    368:       end
    369: 
    370:       ret = call(*args)
    371: 
 => 372:       self.class.hooks[:after].each do |block|
    373:         ret = instance_exec(*args, &block)
    374:       end
    375: 
    376:       ret
    377:     end
nixme commented 12 years ago

Thanks for the report @sent-hil. I've rewritten pry-nav with a different tracer and added breakpoints. Check out pry-debugger: https://github.com/nixme/pry-debugger

Let me know if you still see this issue with pry-debugger. Thanks.

sent-hil commented 12 years ago

@nixme Sorry for taking so long to reply back. I tried it with pry-debugger and I see the same behavior.

sent-hil:~/ $ pry                                                         [13:15:38]
[1] pry(main)> require 'pry-debugger'
=> false
[2] pry(main)> class Post
[2] pry(main)*   def initialize
[2] pry(main)*     binding.pry
[2] pry(main)*     puts 'before'
[2] pry(main)*     puts 'after'
[2] pry(main)*   end  
[2] pry(main)* end  
=> nil
[3] pry(main)> Post.new

From: (pry) @ line 3 Post#initialize:

    3: def initialize
 => 4:   binding.pry
    5:   puts 'before'
    6:   puts 'after'
    7: end

[1] pry(#<Post>)> next

From: (pry) @ line 3 Post#initialize:

    3: def initialize
    4:   binding.pry
 => 5:   puts 'before'
    6:   puts 'after'
    7: end

[3] pry(#<Post>)> next
before

From: (pry) @ line 3 Post#initialize:

    3: def initialize
    4:   binding.pry
    5:   puts 'before'
 => 6:   puts 'after'
    7: end

[5] pry(#<Post>)> next
after

From: /Users/sent-hil/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.10/lib/pry/pry_instance.rb @ line 276 Pry#re:

    271:     code = r(target)
    272: 
    273:     exec_hook :before_eval, code, self
    274: 
    275:     result = target.eval(code, Pry.eval_path, Pry.current_line)
 => 276:     set_last_result(result, target, code)
    277: 
    278:     result
    279:   rescue RescuableException => e
    280:     self.last_exception = e
    281:     e

[7] pry(#<Pry>)> next

From: /Users/sent-hil/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.10/lib/pry/pry_instance.rb @ line 278 Pry#re:

    273:     exec_hook :before_eval, code, self
    274: 
    275:     result = target.eval(code, Pry.eval_path, Pry.current_line)
    276:     set_last_result(result, target, code)
    277: 
 => 278:     result
    279:   rescue RescuableException => e
    280:     self.last_exception = e
    281:     e
    282:   ensure
    283:     update_input_history(code)

[9] pry(#<Pry>)> next

From: /Users/sent-hil/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.10/lib/pry/pry_instance.rb @ line 283 Pry#re:

    278:     result
    279:   rescue RescuableException => e
    280:     self.last_exception = e
    281:     e
    282:   ensure
 => 283:     update_input_history(code)
    284:     exec_hook :after_eval, result, self
    285:   end
    286: 
    287:   # Perform a read.
    288:   # If no parameter is given, default to top-level (main).