Sha256: af1145e5891e169235553d06dacbc30ae0ccc10cc347700dce45b16792275da0

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
require 'rubygems'; require 'require_relative'
require_relative '../command'
require_relative '../../app/util'
require_relative '../breakpoint'
require_relative '../../app/breakpoint'

# disable breakpoint command. The difference however is that the
# parameter to @proc.en_disable_breakpoint_by_number is different (set
# as ENABLE_PARM below).
#
# NOTE: The enable command  subclasses this, so beware when changing! 
class Trepan::Command::DisableCommand < Trepan::Command

  Trepan::Util.suppress_warnings {
    NAME = File.basename(__FILE__, '.rb')
    HELP = <<-HELP
#{NAME} [display] NUM1 [NUM2 ...]

Disables the breakpoints or display given as a space separated list of
numbers. 

See also "enable" and "info break".
  HELP

    CATEGORY      = 'breakpoints'
    SHORT_HELP    = 'Disable some breakpoints or displays'
  }

  def initialize(proc)
    super
    @enable_parm = false # true if enable 
  end
  
  def run(args)
    if args.size == 1
      errmsg('No breakpoint or display number given.')
      return
    end
  if args[1] == 'display'
    args.shift
    first = args.shift
    args.each do |num_str|
      i = @proc.get_an_int(num_str)
      success = @proc.en_disable_display_by_number(i, @enable_parm) if i
      msg("Display %s #{@name}d." % i) if success
    end
  end
    first = args.shift
    args.each do |num_str|
      i = @proc.get_an_int(num_str)
      success = @proc.en_disable_breakpoint_by_number(i, @enable_parm) if i
      msg("Breakpoint %s #{@name}d." % i) if success
    end
  end
end
        
if __FILE__ == $0
  require_relative '../mock'
  dbgr, cmd = MockDebugger::setup
  cmd.run([cmd.name])
  cmd.run([cmd.name, '1'])
  cmdproc = dbgr.core.processor
  cmds = cmdproc.commands
  break_cmd = cmds['break']
  break_cmd.run(['break', cmdproc.frame.source_location[0].to_s])
  # require_relative '../../lib/trepanning'
  # Trepan.debug
  cmd.run([cmd.name, '1'])
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbx-trepanning-0.2.1-universal-rubinius-2.0 processor/command/disable.rb
rbx-trepanning-0.2.1-universal-rubinius-1.2 processor/command/disable.rb
rbx-trepanning-0.2.0-universal-rubinius-2.0 processor/command/disable.rb
rbx-trepanning-0.1.0-universal-rubinius-1.2 processor/command/disable.rb