Sha256: f2ae2ba5726c858b1cac27ec29e1fd8246d33961936255ad7bbc43eb360e057d

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
require_relative 'base/cmd'
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

  # Silence already initialized constant .. warnings
  old_verbose = $VERBOSE  
  $VERBOSE    = nil
  NAME = File.basename(__FILE__, '.rb')
  HELP = <<-HELP
#{NAME} [display] bpnumber [bpnumber ...]
    
Disables the breakpoints given as a space separated list of breakpoint
numbers. See also "info break" to get a list.
  HELP

  CATEGORY      = 'breakpoints'
  SHORT_HELP    = 'Disable some breakpoints'

  $VERBOSE      = old_verbose 

  def initialize(proc)
    super
    @enable_parm = false # true if enable 
  end
  
  def run(args)
    if args.size == 1
      errmsg('No breakpoint number given.')
      return
    end
#   if args[1] == 'display'
#     display_enable(args[2:], 0)
#   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

6 entries across 6 versions & 1 rubygems

Version Path
trepanning-0.1.3 processor/command/disable.rb
trepanning-0.1.2 processor/command/disable.rb
trepanning-0.1.1 processor/command/disable.rb
trepanning-0.1.0 processor/command/disable.rb
trepanning-0.0.9 processor/command/disable.rb
trepanning-0.0.8 processor/command/disable.rb