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

show valid break point lines #393

Merged
merged 18 commits into from Dec 23, 2017

Conversation

Projects
None yet
4 participants
@ko1

ko1 commented Dec 23, 2017

This PR is for usability. Show valid break point lines when break command fails.

Like that:

$ bin/byebug ~/src/rb/t.rb --
/home/ko1/src/rb/byebug/lib/byebug/helpers/bin.rb:15: warning: Insecure world writable dir /home/ko1/src/rb/byebug in PATH, mode 040777

[1, 10] in /home/ko1/src/rb/t.rb
    1:
=>  2: p 0
    3:
    4: def foo
    5:   if false
    6:     return 1
    7:   else
    8:     return 2
    9:   end
   10: end
(byebug) b 5
*** Line 5 is not a valid breakpoint in file /home/ko1/src/rb/t.rb.
Valid break points are:
[B]  2: p 0
     3:
[B]  4: def foo
     5:   if false
     6:     return 1
     7:   else
[B]  8:     return 2
     9:   end
[B] 10: end
    11:


(byebug)

It is hard to find out which lines are valid or not.
I'm not sure it is correct way to output messages, but please consider this idea.

Thanks,
Koichi

@deivid-rodriguez

This comment has been minimized.

Show comment
Hide comment
@deivid-rodriguez

deivid-rodriguez Dec 23, 2017

Owner

@ko1 Thanks so much, this is a great usability improvement indeed! I added some extra changes so that byebug linters and tests are happy, but it looks great. This will be released with the next version! ❤️

Owner

deivid-rodriguez commented Dec 23, 2017

@ko1 Thanks so much, this is a great usability improvement indeed! I added some extra changes so that byebug linters and tests are happy, but it looks great. This will be released with the next version! ❤️

@deivid-rodriguez

This comment has been minimized.

Show comment
Hide comment
@deivid-rodriguez

deivid-rodriguez Dec 23, 2017

Owner

I'll probably add a few extra changes so that the surrounding code respects the user's listsize setting, but this is going in anyways!

Owner

deivid-rodriguez commented Dec 23, 2017

I'll probably add a few extra changes so that the surrounding code respects the user's listsize setting, but this is going in anyways!

@deivid-rodriguez deivid-rodriguez merged commit 3a9ba3a into deivid-rodriguez:master Dec 23, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ko1 ko1 deleted the ko1:show_breakpoints branch Dec 24, 2017

@stevewi

This comment has been minimized.

Show comment
Hide comment
@stevewi

stevewi Jan 10, 2018

This probably sounds like a dumb question... I've cloned the latest byebug-master from GitHub. How do I build/install it? I'm used to 'gem install' but that's about it...

TIA.

stevewi commented Jan 10, 2018

This probably sounds like a dumb question... I've cloned the latest byebug-master from GitHub. How do I build/install it? I'm used to 'gem install' but that's about it...

TIA.

@MSP-Greg

This comment has been minimized.

Show comment
Hide comment
@MSP-Greg

MSP-Greg Jan 10, 2018

Collaborator

@stevewi

There may be an easier way, but normally I do the following, which does give you a gem file in case whatever...

From the repo folder:

  1. gem build byebug,gemspec
  2. gem install -l byebug-9.1.0.gem (version may change)

Reference - RubyGems 2.7.4 Command Reference, same info several places on the web...

Collaborator

MSP-Greg commented Jan 10, 2018

@stevewi

There may be an easier way, but normally I do the following, which does give you a gem file in case whatever...

From the repo folder:

  1. gem build byebug,gemspec
  2. gem install -l byebug-9.1.0.gem (version may change)

Reference - RubyGems 2.7.4 Command Reference, same info several places on the web...

@deivid-rodriguez

This comment has been minimized.

Show comment
Hide comment
@deivid-rodriguez

deivid-rodriguez Jan 10, 2018

Owner

@stevewi Does your application have a Gemfile? In that case, you can also add byebug to that file specifying this: gem "byebug", git: "https://github.com/deivid-rodriguez/byebug", and then run bundle install. Then run any command inside your application folder prefixed with bundle exec.

Owner

deivid-rodriguez commented Jan 10, 2018

@stevewi Does your application have a Gemfile? In that case, you can also add byebug to that file specifying this: gem "byebug", git: "https://github.com/deivid-rodriguez/byebug", and then run bundle install. Then run any command inside your application folder prefixed with bundle exec.

@stevewi

This comment has been minimized.

Show comment
Hide comment
@stevewi

stevewi Jan 10, 2018

My app does have a Gemfile but I also use byebug to debug one-off's and test jigs. I installed the current master as a local gem using the method MSP-Greg described above. When all this gets resolved, I'll install byebug as a global gem again.

The only other thing I had to change on one system is a modification to my PATH on one Linux system to include $HOME/.gems/bin. My problem, not yours :-)

Thanks!

stevewi commented Jan 10, 2018

My app does have a Gemfile but I also use byebug to debug one-off's and test jigs. I installed the current master as a local gem using the method MSP-Greg described above. When all this gets resolved, I'll install byebug as a global gem again.

The only other thing I had to change on one system is a modification to my PATH on one Linux system to include $HOME/.gems/bin. My problem, not yours :-)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment