class DEBUGGER__::Breakpoint

Attributes

key[R]
skip_src[R]

Public Class Methods

new(cond, command, path, do_enable: true) click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 11
def initialize cond, command, path, do_enable: true
  @deleted = false

  @cond = cond
  @command = command
  @path = path

  setup
  enable if do_enable
end

Public Instance Methods

delete() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 52
def delete
  disable
  @deleted = true
end
deleted?() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 57
def deleted?
  @deleted
end
description() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 80
def description
  to_s
end
disable() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 44
def disable
  @tp&.disable
end
duplicable?() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 84
def duplicable?
  false
end
enable() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 40
def enable
  @tp.enable
end
enabled?() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 48
def enabled?
  @tp.enabled?
end
generate_label(name) click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 101
def generate_label(name)
  colorize(" BP - #{name} ", [:YELLOW, :BOLD, :REVERSE])
end
oneshot?() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 32
def oneshot?
  defined?(@oneshot) && @oneshot
end
safe_eval(b, expr) click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 22
def safe_eval b, expr
  b.eval(expr)
rescue Exception => e
  puts "[EVAL ERROR]"
  puts "  expr: #{expr}"
  puts "  err: #{e} (#{e.class})"
  puts "Error caused by #{self}."
  nil
end
setup() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 36
def setup
  raise "not implemented..."
end
skip_path?(path) click to toggle source
Calls superclass method DEBUGGER__::SkipPathHelper#skip_path?
# File debug-1.8.0/lib/debug/breakpoint.rb, line 88
def skip_path?(path)
  case @path
  when Regexp
    !path.match?(@path)
  when String
    !path.include?(@path)
  else
    super
  end
end
suspend() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 61
def suspend
  if @command
    provider, pre_cmds, do_cmds = @command
    nonstop = true if do_cmds
    cmds = [*pre_cmds&.split(';;'), *do_cmds&.split(';;')]
    SESSION.add_preset_commands provider, cmds, kick: false, continue: nonstop
  end

  ThreadClient.current.on_breakpoint @tp, self
end
to_s() click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 72
def to_s
  s = ''.dup
  s << " if: #{@cond}"        if defined?(@cond) && @cond
  s << " pre: #{@command[1]}" if defined?(@command) && @command && @command[1]
  s << " do: #{@command[2]}"  if defined?(@command) && @command && @command[2]
  s
end