Sha256: ff2e3f3b8b8ac5f69bb3e113a336d5aa8749f312a809623a737aca7e87f05ce7

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Byebug

  # Implements byebug's 'finish' command.
  class FinishCommand < Command
    self.allow_in_post_mortem = false
    self.need_context         = true

    def regexp
      /^\s* fin(?:ish)? (?:\s+(\S+))? \s*$/x
    end

    def execute
      max_frame = @state.context.stack_size - @state.frame_pos
      if not @match[1]
        frame_pos = @state.frame_pos
      else
        frame_pos = get_int(@match[1], "Finish", 0, max_frame-1, 0)
        return nil unless frame_pos
      end
      @state.context.step_out frame_pos
      @state.frame_pos = 0
      @state.proceed
    end

    class << self
      def names
        %w(finish)
      end

      def description
        %{fin[ish][ frame-number]\tExecute until selected stack frame returns.

          If no frame number is given, we run until the currently selected frame
          returns. The currently selected frame starts out the most-recent frame
          or 0 if no frame positioning (e.g "up", "down" or "frame") has been
          performed.

          If a frame number is given we run until that frame returns.}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
byebug-1.8.2 lib/byebug/commands/finish.rb