Sha256: 93308c166326fc16af79cc357b6f86ec904df44b258c0e414d613f62f7af2fb2

Contents?: true

Size: 1.85 KB

Versions: 6

Compression:

Stored size: 1.85 KB

Contents

module Debugger
  class NextCommand < Command
    def regexp
      /^\s*n(?:ext)?(?:\s+(\d+))?$/
    end

    def execute
      steps = @match[1] ? @match[1].to_i : 1
      @state.context.step_over steps, @state.context.frames.size - @state.frame_pos
      @state.proceed
    end

    class << self
      def help_command
        'next'
      end

      def help(cmd)
        %{
          n[ext][ nnn]\tgo over one line or till line nnn
        }
      end
    end
  end

  class StepCommand < Command
    def regexp
      /^\s*s(?:tep)?(?:\s+(\d+))?$/
    end

    def execute
      @state.context.stop_next = @match[1] ? @match[1].to_i : 1
      @state.proceed
    end

    class << self
      def help_command
        'step'
      end

      def help(cmd)
        %{
          s[tep][ nnn]\tstep (into methods) one line or till line nnn
        }
      end
    end
  end

  class FinishCommand < Command
    def regexp
      /^\s*fin(?:ish)?$/
    end

    def execute
      if @state.frame_pos == @state.context.frames.size
        print "\"finish\" not meaningful in the outermost frame.\n"
      else
        @state.context.stop_frame = @state.context.frames.size - @state.frame_pos
        @state.frame_pos = 0
        @state.proceed
      end
    end

    class << self
      def help_command
        'finish'
      end

      def help(cmd)
        %{
          fin[ish]\treturn to outer frame
        }
      end
    end
  end

  class ContinueCommand < Command
    def regexp
      /^\s*c(?:ont)?$|^\s*r(?:un)?$/
    end

    def execute
      @state.proceed
    end

    class << self
      def help_command
        %w|cont run|
      end

      def help(cmd)
        if cmd == 'cont'
          %{
            c[ont]\trun until program ends or hit breakpoint
          }
        else
          %{
            r[un]\talias for cont
          }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-debug-0.4.1-mswin32 lib/ruby-debug/commands/stepping.rb
ruby-debug-0.4-mswin32 lib/ruby-debug/commands/stepping.rb
ruby-debug-0.3-mswin32 lib/ruby-debug/commands/stepping.rb
ruby-debug-0.3 lib/ruby-debug/commands/stepping.rb
ruby-debug-0.4.1 lib/ruby-debug/commands/stepping.rb
ruby-debug-0.4 lib/ruby-debug/commands/stepping.rb