pry / pry-stack_explorer

Walk the stack in a Pry session

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

it doesn't show stack after running to a breakpoint

x-yuri opened this issue · comments

#!/usr/bin/env ruby
require 'pry'
def f
  puts 'f'
end
binding.pry
f
$ ./1.rb

Frame number: 0/6

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

    2: require 'pry'
    3: def f
    4:   puts 'f'
    5: end
    6: binding.pry
 => 7: f

[1] pry(main)> show-stack
when_started hook failed: NoMethodError: private method `eval' called for nil:NilClass
/home/yuri/.gem/ruby/2.1.5/gems/pry-stack_explorer-0.4.9.1/lib/pry-stack_explorer.rb:109:in `bindings_equal?'
(see _pry_.hooks.errors to debug)

Showing all accessible frames in stack (7 in total):
--
=> #0  <main> 
   #1 [block]   block in run <PryByebug::Processor#run(initial=?, &_block)>
   #2 [method]  run <PryByebug::Processor#run(initial=?, &_block)>
   #3 [method]  resume_pry <PryByebug::Processor#resume_pry(context)>
   #4 [method]  at_line <PryByebug::Processor#at_line(context, _file, _line)>
   #5 [method]  at_line <Byebug::Context#at_line(file, line)>
   #6 [main]    <main>
[2] pry(main)> break #f
Breakpoint 1: Object#f (Enabled) :

3: def f
4:   puts 'f'
5: end

[3] pry(main)> c
when_started hook failed: NoMethodError: undefined method `last' for nil:NilClass
/home/yuri/.gem/ruby/2.1.5/gems/pry-stack_explorer-0.4.9.1/lib/pry-stack_explorer/when_started_hook.rb:49:in `remove_internal_frames'
(see _pry_.hooks.errors to debug)

Breakpoint 1. First hit

From: /home/yuri/_/1.rb @ line 3 Object#f:

 => 3: def f
    4:   puts 'f'
    5: end

[1] pry(main):1> show-stack
No caller stack available!
[2] pry(main):1> quit
=> #<Pry::Result:0x007faa46ff2470 @is_command=true, @retval=main>
[3] pry(main)> show-stack
No caller stack available!
[4] pry(main)> quit
f

Aside from pry-stack_explorer, there's also pry-byebug loaded.

Same here. But I'm getting
when_started hook failed: TypeError: bind argument must be an instance of Object /home/gbmoretti/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/pry-0.9.12.6/lib/pry/helpers/base_helpers.rb:23:inbind'
(see pry.hooks.errors to debug)` warning

@gbmoretti pry-byebug is incompatible with pry-stack_explorer but it provides equivalent functionality built-in.