Sha256: 617d4ba1aded69d0076679770336ba14d478314782e2aca7999336b9b3ba4157

Contents?: true

Size: 1.27 KB

Versions: 41

Compression:

Stored size: 1.27 KB

Contents

module Debugger

  class ConditionCommand < Command # :nodoc:
    self.control = true

    def regexp
      /^\s* cond(?:ition)? (?:\s+(\d+)\s*(.*))?$/ix
    end
    
    def execute
      if not @match[1]
        errmsg "\"condition\" must be followed a breakpoint number and expression\n"
      else
        breakpoints = Debugger.breakpoints.sort_by{|b| b.id }
        largest = breakpoints.inject(0) do |largest, b| 
          largest = b.id if b.id > largest
        end
        if 0 == largest
          print "No breakpoints have been set.\n"
          return
        end
        pos = get_int(@match[1], "Condition", 1, largest)
        return unless pos
        breakpoints.each do |b|
          if b.id == pos 
            b.expr = @match[2].empty? ? nil : @match[2]
            print_contdition_set(b.id)
            break
          end
        end

      end
    end
    
    class << self
      def help_command
        'condition'
      end

      def help(cmd)
        %{
          Condition breakpoint-number expression
Specify breakpoint number N to break only if COND is true.
N is an integer and COND is an expression to be evaluated whenever 
breakpoint N is reached. If the empty string is used, the condition is removed.
        }
      end
    end
  end

end # module Debugger

Version data entries

41 entries across 41 versions & 3 rubygems

Version Path
ruby-debug-ide-0.4.23.beta1 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.22 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.21 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.21.pre1 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.18 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.17 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.17.beta17 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.17.beta16 lib/ruby-debug-ide/commands/condition.rb
debugger-ide-0.0.2 lib/ruby-debug/commands/condition.rb
ruby-debug-ide-0.4.17.beta14 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.17.beta13 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.17.beta12 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.17.beta9 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.4.17.beta8 lib/ruby-debug/commands/condition.rb
ruby-debug-ide-0.4.17.beta6 lib/ruby-debug/commands/condition.rb
ruby-debug-ide-0.4.17.beta5 lib/ruby-debug/commands/condition.rb
ruby-debug-ide-0.4.17.beta4 lib/ruby-debug/commands/condition.rb
ruby-debug-ide-0.4.17.beta3 lib/ruby-debug/commands/condition.rb
ruby-debug-ide-0.4.16 lib/ruby-debug/commands/condition.rb
ruby-debug-ide-0.4.11 lib/ruby-debug/commands/condition.rb