byebug 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -0
- data/lib/byebug/commands/control.rb +24 -0
- data/lib/byebug/commands/frame.rb +1 -0
- data/lib/byebug/context.rb +7 -2
- data/lib/byebug/remote.rb +23 -0
- data/lib/byebug/version.rb +1 -1
- data/test/examples/interrupt.rb +8 -0
- data/test/interrupt_test.rb +58 -0
- metadata +22 -18
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8dee4a41cee3ad39319608f90aa34ca73e6b3578
         | 
| 4 | 
            +
              data.tar.gz: e2434363c37285a549aaabbd236dd7c832f460e8
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f2967314e28007dc029dca83fff42fad6b494483a4e14ebc6ffa4aa2f3b2433797cc113fb1f575db2cb52b7f14656dd047fef1f07550f3e772a68ffc2eb7da99
         | 
| 7 | 
            +
              data.tar.gz: f8c59999bfc524f43d8b925a092f7a26831b173b85d4c1d3ab80448be02bbb95707bc9ec7e82b1cba63851c089c7fd61e9a4224c9a92c4b469a263e21f10e81d
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -126,6 +126,8 @@ started. Proper documentation will be eventually written. | |
| 126 126 | 
             
            adds a rake task that restarts Passenger with byebug connected.
         | 
| 127 127 | 
             
            * [minitest-byebug](https://github.com/kaspth/minitest-byebug) starts a byebug
         | 
| 128 128 | 
             
            session on minitest failures.
         | 
| 129 | 
            +
            * [sublime-debugger](https://github.com/shuky19/sublime_debugger) provides a plugin
         | 
| 130 | 
            +
            for ruby debugging on Sublime Text.
         | 
| 129 131 |  | 
| 130 132 |  | 
| 131 133 | 
             
            ## Future (possible) directions
         | 
| @@ -63,4 +63,28 @@ module Byebug | |
| 63 63 | 
             
                end
         | 
| 64 64 | 
             
              end
         | 
| 65 65 |  | 
| 66 | 
            +
              class InterruptCommand < Command
         | 
| 67 | 
            +
                self.allow_in_control     = true
         | 
| 68 | 
            +
                self.allow_in_post_mortem = false
         | 
| 69 | 
            +
                self.need_context         = true
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                def regexp
         | 
| 72 | 
            +
                  /^\s*i(?:nterrupt)?\s*$/
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                def execute
         | 
| 76 | 
            +
                    context = Byebug.thread_context(Thread.main)
         | 
| 77 | 
            +
                    context.interrupt
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                class << self
         | 
| 81 | 
            +
                  def names
         | 
| 82 | 
            +
                    %w(interrupt)
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                  def description
         | 
| 86 | 
            +
                    %{i|nterrupt\t interrupt the program}
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
                end
         | 
| 89 | 
            +
              end
         | 
| 66 90 | 
             
            end
         | 
    
        data/lib/byebug/context.rb
    CHANGED
    
    | @@ -4,8 +4,9 @@ module Byebug | |
| 4 4 |  | 
| 5 5 | 
             
                class << self
         | 
| 6 6 | 
             
                  def stack_size
         | 
| 7 | 
            -
                    if backtrace = Thread.current.backtrace_locations( | 
| 8 | 
            -
                      backtrace.drop_while { |l| ignored(l.path)  | 
| 7 | 
            +
                    if backtrace = Thread.current.backtrace_locations(0)
         | 
| 8 | 
            +
                      backtrace.drop_while { |l| !ignored(l.path) }
         | 
| 9 | 
            +
                               .drop_while { |l| ignored(l.path) || l.path == '(eval)' }
         | 
| 9 10 | 
             
                               .take_while { |l| !ignored(l.path) }
         | 
| 10 11 | 
             
                               .size
         | 
| 11 12 | 
             
                    else
         | 
| @@ -26,6 +27,10 @@ module Byebug | |
| 26 27 | 
             
                  private :ignored
         | 
| 27 28 | 
             
                end
         | 
| 28 29 |  | 
| 30 | 
            +
                def interrupt
         | 
| 31 | 
            +
                  self.step_into 1
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 29 34 | 
             
                def frame_locals frame_no = 0
         | 
| 30 35 | 
             
                  bind = frame_binding frame_no
         | 
| 31 36 | 
             
                  eval "local_variables.inject({}){|h, v| h[v] = eval(v.to_s); h}", bind
         | 
    
        data/lib/byebug/remote.rb
    CHANGED
    
    | @@ -12,6 +12,14 @@ module Byebug | |
| 12 12 |  | 
| 13 13 | 
             
                # The actual port that the server is started at
         | 
| 14 14 | 
             
                attr_accessor :actual_port
         | 
| 15 | 
            +
                attr_reader :actual_control_port
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                #
         | 
| 18 | 
            +
                # Interrupts the current thread
         | 
| 19 | 
            +
                #
         | 
| 20 | 
            +
                def interrupt
         | 
| 21 | 
            +
                  current_context.interrupt
         | 
| 22 | 
            +
                end
         | 
| 15 23 |  | 
| 16 24 | 
             
                #
         | 
| 17 25 | 
             
                # Starts a remote byebug
         | 
| @@ -22,6 +30,8 @@ module Byebug | |
| 22 30 | 
             
                  self.interface = nil
         | 
| 23 31 | 
             
                  start
         | 
| 24 32 |  | 
| 33 | 
            +
                  start_control(host, port == 0 ? 0 : port + 1)
         | 
| 34 | 
            +
             | 
| 25 35 | 
             
                  yield if block_given?
         | 
| 26 36 |  | 
| 27 37 | 
             
                  mutex = Mutex.new
         | 
| @@ -46,6 +56,19 @@ module Byebug | |
| 46 56 | 
             
                  end
         | 
| 47 57 | 
             
                end
         | 
| 48 58 |  | 
| 59 | 
            +
                def start_control(host = nil, ctrl_port = PORT + 1)
         | 
| 60 | 
            +
                   return @actual_control_port if @control_thread
         | 
| 61 | 
            +
                   server = TCPServer.new(host, ctrl_port)
         | 
| 62 | 
            +
                   @actual_control_port = server.addr[1]
         | 
| 63 | 
            +
                   @control_thread = Thread.new do
         | 
| 64 | 
            +
                     while (session = server.accept)
         | 
| 65 | 
            +
                       interface = RemoteInterface.new(session)
         | 
| 66 | 
            +
                       ControlCommandProcessor.new(interface).process_commands
         | 
| 67 | 
            +
                     end
         | 
| 68 | 
            +
                   end
         | 
| 69 | 
            +
                   @actual_control_port
         | 
| 70 | 
            +
                end
         | 
| 71 | 
            +
             | 
| 49 72 | 
             
                #
         | 
| 50 73 | 
             
                # Connects to the remote byebug
         | 
| 51 74 | 
             
                #
         | 
    
        data/lib/byebug/version.rb
    CHANGED
    
    
| @@ -0,0 +1,58 @@ | |
| 1 | 
            +
            class InterruptExample
         | 
| 2 | 
            +
              def self.a(num)
         | 
| 3 | 
            +
                num += 2
         | 
| 4 | 
            +
                b(num)
         | 
| 5 | 
            +
              end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              def self.b(num)
         | 
| 8 | 
            +
                v2 = 5 if 1 == num ; [1, 2, v2].map { |a| a.to_f }
         | 
| 9 | 
            +
                c(num)
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def self.c(num)
         | 
| 13 | 
            +
                num += 4
         | 
| 14 | 
            +
                num
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            class TestInterrupting < TestDsl::TestCase
         | 
| 19 | 
            +
              describe 'Interrupt Command' do
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                describe 'method call behaviour' do
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  it 'must interrupt on the next line' do
         | 
| 24 | 
            +
                    enter 'interrupt'
         | 
| 25 | 
            +
                    enter 'continue'
         | 
| 26 | 
            +
                    debug_file('interrupt') do
         | 
| 27 | 
            +
                      state.line.must_equal 3
         | 
| 28 | 
            +
                      state.file.must_equal __FILE__
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  describe 'when forcestep is set' do
         | 
| 33 | 
            +
                    temporary_change_hash Byebug.settings, :forcestep, true
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                    it 'must interrupt on the next line' do
         | 
| 36 | 
            +
                      enter 'interrupt'
         | 
| 37 | 
            +
                      enter 'continue'
         | 
| 38 | 
            +
                      debug_file('interrupt') do
         | 
| 39 | 
            +
                        state.line.must_equal 3
         | 
| 40 | 
            +
                        state.file.must_equal __FILE__
         | 
| 41 | 
            +
                      end
         | 
| 42 | 
            +
                    end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    describe 'block behaviour' do
         | 
| 45 | 
            +
                      before { enter 'break 4', 'cont' }
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                      it 'must step into blocks' do
         | 
| 48 | 
            +
                        enter 'interrupt'
         | 
| 49 | 
            +
                        enter 'continue'
         | 
| 50 | 
            +
                        debug_file('interrupt') do
         | 
| 51 | 
            +
                          state.line.must_equal 5
         | 
| 52 | 
            +
                        end
         | 
| 53 | 
            +
                      end
         | 
| 54 | 
            +
                    end
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
              end
         | 
| 58 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: byebug
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Rodriguez
         | 
| @@ -10,90 +10,90 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2013-12- | 
| 13 | 
            +
            date: 2013-12-14 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: columnize
         | 
| 17 17 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 | 
            -
                - -  | 
| 19 | 
            +
                - - ~>
         | 
| 20 20 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 21 | 
             
                    version: 0.3.6
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 24 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 25 | 
             
                requirements:
         | 
| 26 | 
            -
                - -  | 
| 26 | 
            +
                - - ~>
         | 
| 27 27 | 
             
                  - !ruby/object:Gem::Version
         | 
| 28 28 | 
             
                    version: 0.3.6
         | 
| 29 29 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 30 30 | 
             
              name: debugger-linecache
         | 
| 31 31 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 32 32 | 
             
                requirements:
         | 
| 33 | 
            -
                - -  | 
| 33 | 
            +
                - - ~>
         | 
| 34 34 | 
             
                  - !ruby/object:Gem::Version
         | 
| 35 35 | 
             
                    version: 1.2.0
         | 
| 36 36 | 
             
              type: :runtime
         | 
| 37 37 | 
             
              prerelease: false
         | 
| 38 38 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                requirements:
         | 
| 40 | 
            -
                - -  | 
| 40 | 
            +
                - - ~>
         | 
| 41 41 | 
             
                  - !ruby/object:Gem::Version
         | 
| 42 42 | 
             
                    version: 1.2.0
         | 
| 43 43 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 44 44 | 
             
              name: rake
         | 
| 45 45 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 46 46 | 
             
                requirements:
         | 
| 47 | 
            -
                - -  | 
| 47 | 
            +
                - - ~>
         | 
| 48 48 | 
             
                  - !ruby/object:Gem::Version
         | 
| 49 49 | 
             
                    version: 10.1.0
         | 
| 50 50 | 
             
              type: :development
         | 
| 51 51 | 
             
              prerelease: false
         | 
| 52 52 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 53 53 | 
             
                requirements:
         | 
| 54 | 
            -
                - -  | 
| 54 | 
            +
                - - ~>
         | 
| 55 55 | 
             
                  - !ruby/object:Gem::Version
         | 
| 56 56 | 
             
                    version: 10.1.0
         | 
| 57 57 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 58 58 | 
             
              name: rake-compiler
         | 
| 59 59 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 60 60 | 
             
                requirements:
         | 
| 61 | 
            -
                - -  | 
| 61 | 
            +
                - - ~>
         | 
| 62 62 | 
             
                  - !ruby/object:Gem::Version
         | 
| 63 63 | 
             
                    version: 0.9.2
         | 
| 64 64 | 
             
              type: :development
         | 
| 65 65 | 
             
              prerelease: false
         | 
| 66 66 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 67 67 | 
             
                requirements:
         | 
| 68 | 
            -
                - -  | 
| 68 | 
            +
                - - ~>
         | 
| 69 69 | 
             
                  - !ruby/object:Gem::Version
         | 
| 70 70 | 
             
                    version: 0.9.2
         | 
| 71 71 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 72 72 | 
             
              name: mocha
         | 
| 73 73 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 74 74 | 
             
                requirements:
         | 
| 75 | 
            -
                - -  | 
| 75 | 
            +
                - - ~>
         | 
| 76 76 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 77 | 
             
                    version: 0.14.0
         | 
| 78 78 | 
             
              type: :development
         | 
| 79 79 | 
             
              prerelease: false
         | 
| 80 80 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 81 81 | 
             
                requirements:
         | 
| 82 | 
            -
                - -  | 
| 82 | 
            +
                - - ~>
         | 
| 83 83 | 
             
                  - !ruby/object:Gem::Version
         | 
| 84 84 | 
             
                    version: 0.14.0
         | 
| 85 85 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 86 86 | 
             
              name: minitest
         | 
| 87 87 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 88 88 | 
             
                requirements:
         | 
| 89 | 
            -
                - -  | 
| 89 | 
            +
                - - ~>
         | 
| 90 90 | 
             
                  - !ruby/object:Gem::Version
         | 
| 91 91 | 
             
                    version: 5.0.8
         | 
| 92 92 | 
             
              type: :development
         | 
| 93 93 | 
             
              prerelease: false
         | 
| 94 94 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 95 95 | 
             
                requirements:
         | 
| 96 | 
            -
                - -  | 
| 96 | 
            +
                - - ~>
         | 
| 97 97 | 
             
                  - !ruby/object:Gem::Version
         | 
| 98 98 | 
             
                    version: 5.0.8
         | 
| 99 99 | 
             
            description: |-
         | 
| @@ -111,8 +111,8 @@ extensions: | |
| 111 111 | 
             
            extra_rdoc_files:
         | 
| 112 112 | 
             
            - README.md
         | 
| 113 113 | 
             
            files:
         | 
| 114 | 
            -
            -  | 
| 115 | 
            -
            -  | 
| 114 | 
            +
            - .gitignore
         | 
| 115 | 
            +
            - .travis.yml
         | 
| 116 116 | 
             
            - CHANGELOG.md
         | 
| 117 117 | 
             
            - CONTRIBUTING.md
         | 
| 118 118 | 
             
            - GUIDE.md
         | 
| @@ -191,6 +191,7 @@ files: | |
| 191 191 | 
             
            - test/examples/help.rb
         | 
| 192 192 | 
             
            - test/examples/info.rb
         | 
| 193 193 | 
             
            - test/examples/info2.rb
         | 
| 194 | 
            +
            - test/examples/interrupt.rb
         | 
| 194 195 | 
             
            - test/examples/kill.rb
         | 
| 195 196 | 
             
            - test/examples/list.rb
         | 
| 196 197 | 
             
            - test/examples/method.rb
         | 
| @@ -217,6 +218,7 @@ files: | |
| 217 218 | 
             
            - test/frame_test.rb
         | 
| 218 219 | 
             
            - test/help_test.rb
         | 
| 219 220 | 
             
            - test/info_test.rb
         | 
| 221 | 
            +
            - test/interrupt_test.rb
         | 
| 220 222 | 
             
            - test/kill_test.rb
         | 
| 221 223 | 
             
            - test/list_test.rb
         | 
| 222 224 | 
             
            - test/method_test.rb
         | 
| @@ -248,12 +250,12 @@ require_paths: | |
| 248 250 | 
             
            - lib
         | 
| 249 251 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 250 252 | 
             
              requirements:
         | 
| 251 | 
            -
              - -  | 
| 253 | 
            +
              - - '>='
         | 
| 252 254 | 
             
                - !ruby/object:Gem::Version
         | 
| 253 255 | 
             
                  version: 2.0.0
         | 
| 254 256 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 255 257 | 
             
              requirements:
         | 
| 256 | 
            -
              - -  | 
| 258 | 
            +
              - - '>='
         | 
| 257 259 | 
             
                - !ruby/object:Gem::Version
         | 
| 258 260 | 
             
                  version: '0'
         | 
| 259 261 | 
             
            requirements: []
         | 
| @@ -285,6 +287,7 @@ test_files: | |
| 285 287 | 
             
            - test/examples/help.rb
         | 
| 286 288 | 
             
            - test/examples/info.rb
         | 
| 287 289 | 
             
            - test/examples/info2.rb
         | 
| 290 | 
            +
            - test/examples/interrupt.rb
         | 
| 288 291 | 
             
            - test/examples/kill.rb
         | 
| 289 292 | 
             
            - test/examples/list.rb
         | 
| 290 293 | 
             
            - test/examples/method.rb
         | 
| @@ -311,6 +314,7 @@ test_files: | |
| 311 314 | 
             
            - test/frame_test.rb
         | 
| 312 315 | 
             
            - test/help_test.rb
         | 
| 313 316 | 
             
            - test/info_test.rb
         | 
| 317 | 
            +
            - test/interrupt_test.rb
         | 
| 314 318 | 
             
            - test/kill_test.rb
         | 
| 315 319 | 
             
            - test/list_test.rb
         | 
| 316 320 | 
             
            - test/method_test.rb
         |