Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

break throws NoMethodError on master #32

Closed
caius opened this issue Aug 7, 2014 · 6 comments
Closed

break throws NoMethodError on master #32

caius opened this issue Aug 7, 2014 · 6 comments

Comments

@caius
Copy link

caius commented Aug 7, 2014

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.

@caius
Copy link
Author

caius commented Aug 7, 2014

It also appears to happen when specifying a line with file:linenumber:

2.1.2 (main):0 > break /tmp/fred.rb:2
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'

@deivid-rodriguez
Copy link
Owner

Can you try again using byebug's last master as well? Thanks!!

@caius
Copy link
Author

caius commented Aug 7, 2014

I can set the breakpoint ok with byebug's master now; but I have to call Byebug.start before it activates the breakpoint and actually drops to a debugger - is that expected? I think that's a break with the behaviour of 3.2.0 (but I'm not sure on that.)

@deivid-rodriguez
Copy link
Owner

I've added your workaround to latest master. Does it work now?

@caius
Copy link
Author

caius commented Aug 7, 2014

Yippie! Works as I expect with previous behaviour, and by not exiting on continue being used.

$ 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
Breakpoint 1: Fred#foo (Enabled) :

2: class Fred; def foo; end; end

2.1.2 (main):0 > Fred.new.foo

Breakpoint 1. First hit.

From: (pry) @ line 2 Fred#foo:

 => 2: class Fred; def foo; end; end

2.1.2 (#<Fred:0x007fd616e230a8>):1 > continue
=> nil
2.1.2 (main):0 > continue # Just for giggles
Error: Cannot find local context. Did you use `binding.pry`?

Many thanks for adding this 😄 👍💯

@deivid-rodriguez
Copy link
Owner

Awesome @caius, you are welcome!! And thanks for the testing & quick feedback!!

deivid-rodriguez pushed a commit that referenced this issue Sep 1, 2014
The workaround is not needed anymore because it is fixed in byebug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants