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 not work well when exists more than one break point. #12

Open
zw963 opened this issue Apr 23, 2022 · 2 comments
Open

break not work well when exists more than one break point. #12

zw963 opened this issue Apr 23, 2022 · 2 comments

Comments

@zw963
Copy link

zw963 commented Apr 23, 2022

See following example:

require 'pry'
require 'break'

  puts 100
  binding.pry
  puts 200
  binding.pry
  puts 300

Following is debug process:

╰─ $ RUBYOPT='-I./lib -rpryx' ruby 1.rb
100

From: /home/common/Project/pryx/1.rb:5 :

    1: require 'pry'
    2: require 'break'
    3: 
    4:   puts 100
 => 5:   binding.pry
    6:   puts 200
    7:   binding.pry
    8:   puts 300

[1] pry(main)> next

From: /home/common/Project/pryx/1.rb:6 :

    1: require 'pry'
    2: require 'break'
    3: 
    4:   puts 100
    5:   binding.pry
 => 6:   puts 200
    7:   binding.pry
    8:   puts 300

[1] pry(main)> next
200

From: /home/common/Project/pryx/1.rb:7 :

    2: require 'break'
    3: 
    4:   puts 100
    5:   binding.pry
    6:   puts 200
 => 7:   binding.pry                  # <= when break point reach here, will cause many times next to goto next line.
    8:   puts 300

[1] pry(main)> next
[1] pry(main)> next
[1] pry(main)> next
[1] pry(main)> next

From: /home/common/Project/pryx/1.rb:7 :

    2: require 'break'
    3: 
    4:   puts 100
    5:   binding.pry
    6:   puts 200
 => 7:   binding.pry
    8:   puts 300

[1] pry(main)> next
[1] pry(main)> next
[1] pry(main)> next
[1] pry(main)> next
[1] pry(main)> next

From: /home/common/Project/pryx/1.rb:8 :

    3: 
    4:   puts 100
    5:   binding.pry
    6:   puts 200
    7:   binding.pry
 => 8:   puts 300

[1] pry(main)> next                            # <= same above here.
[1] pry(main)> next
300

Following is same things when run with irb

╰─ $ RUBYOPT='-I./lib -rpryx_irb' ruby 1.rb
100

From: 1.rb @ line 5 :
    4:   puts 100
    6:   puts 200
    7:   binding.irb
    8:   puts 300

3.1.0 :001 > next

From: 1.rb @ line 6 :   
                        
    5:   binding.irb
    7:   binding.irb
    8:   puts 300

3.1.0 :001 > next
200
                        
From: 1.rb @ line 7 :   
                        
    2: require 'break'  
 => 7:   binding.irb
    8:   puts 300

3.1.0 :001 > next

From: /home/zw963/.rvm/rubies/ruby-3.1.0/.irbrc @ line 8 :
                        
     3: # It also loads your custom ~/.irbrc if it exists.
     4: # If you want to customize the irbrc for ONLY this version of
     5: # ruby then edit this file. It will only be deleted if you do
     6: # an "rvm install" over this ruby version.
     7: 
 =>  8: if ENV["rvm_path"].nil?
     9:   require File.join(ENV["HOME"], "irbrc")
    10: else
    11:   require File.join(ENV["rvm_path"], "scripts", "irbrc")
    12: end
    13: 

irb(main):001:0> next

From: /home/zw963/.rvm/rubies/ruby-3.1.0/.irbrc @ line 11 :
                            
     6: # an "rvm install" over this ruby version.
     7:                     
     8: if ENV["rvm_path"].nil?
     9:   require File.join(ENV["HOME"], "irbrc")
    10: else
 => 11:   require File.join(ENV["rvm_path"], "scripts", "irbrc")
    12: end
    13: 

irb(main):001:0> next

irb(main):001:0> next

From: 1.rb @ line 7 :       
                            
    2: require 'break'      
    3:                      
    4:   puts 100
    5:   binding.irb
    6:   puts 200
 => 7:   binding.irb
    8:   puts 300

irb(main):001:0> next

irb(main):001:0> next

                            
From: 1.rb @ line 8 :       
                            
    3:                      
    4:   puts 100
    5:   binding.irb
    6:   puts 200
    7:   binding.irb
 => 8:   puts 300

irb(main):001:0> 
irb(main):002:0> next
300
@gsamokovarov
Copy link
Owner

I know about this issue but I haven't been able to solve it so far.

@zw963
Copy link
Author

zw963 commented Apr 24, 2022

There is another issue maybe related to this issue.

When use step into a method, the next next command is not move. following is a screenshot.

image

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