class Byebug::InfoCommand::BreakpointsCommand
Information about current breakpoints
Public Class Methods
description()
click to toggle source
# File lib/byebug/commands/info/breakpoints.rb, line 18 def self.description <<-DESCRIPTION inf[o] b[reakpoints] #{short_description} DESCRIPTION end
regexp()
click to toggle source
# File lib/byebug/commands/info/breakpoints.rb, line 14 def self.regexp /^\s* b(?:reakpoints)? (?:\s+ (.+))? \s*$/x end
short_description()
click to toggle source
# File lib/byebug/commands/info/breakpoints.rb, line 26 def self.short_description "Status of user settable breakpoints" end
Public Instance Methods
execute()
click to toggle source
# File lib/byebug/commands/info/breakpoints.rb, line 30 def execute return puts("No breakpoints.") if Byebug.breakpoints.empty? breakpoints = Byebug.breakpoints.sort_by(&:id) if @match[1] indices = @match[1].split(/ +/).map(&:to_i) breakpoints = breakpoints.select { |b| indices.member?(b.id) } if breakpoints.empty? return errmsg("No breakpoints found among list given") end end puts "Num Enb What" breakpoints.each { |b| info_breakpoint(b) } end
Private Instance Methods
info_breakpoint(brkpt)
click to toggle source
# File lib/byebug/commands/info/breakpoints.rb, line 49 def info_breakpoint(brkpt) interp = format( "%-<id>3d %-<status>3s at %<file>s:%<line>s%<expression>s", id: brkpt.id, status: brkpt.enabled? ? "y" : "n", file: brkpt.source, line: brkpt.pos, expression: brkpt.expr.nil? ? "" : " if #{brkpt.expr}" ) puts interp hits = brkpt.hit_count return unless hits > 0 s = hits > 1 ? "s" : "" puts " breakpoint already hit #{hits} time#{s}" end