File: down.rb

package info (click to toggle)
ruby-byebug 11.1.3-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,252 kB
  • sloc: ruby: 8,835; ansic: 1,662; sh: 6; makefile: 4
file content (45 lines) | stat: -rw-r--r-- 912 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

require "pathname"
require_relative "../command"
require_relative "../helpers/frame"
require_relative "../helpers/parse"

module Byebug
  #
  # Move the current frame down in the backtrace.
  #
  class DownCommand < Command
    include Helpers::FrameHelper
    include Helpers::ParseHelper

    self.allow_in_post_mortem = true

    def self.regexp
      /^\s* down (?:\s+(\S+))? \s*$/x
    end

    def self.description
      <<-DESCRIPTION
        down[ count]

        #{short_description}

        Use the "bt" command to find out where you want to go.
      DESCRIPTION
    end

    def self.short_description
      "Moves to a lower frame in the stack trace"
    end

    def execute
      pos, err = parse_steps(@match[1], "Down")
      return errmsg(err) unless pos

      jump_frames(-pos)

      ListCommand.new(processor).execute if Setting[:autolist]
    end
  end
end