Sha256: 2e3b00f93fd713e2c390283583b0c12c6cfbb0a7b08516f3890276661b744cad

Contents?: true

Size: 1.3 KB

Versions: 20

Compression:

Stored size: 1.3 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_so_far, b|
          b.id if b.id > largest_so_far
        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 : Command.unescape_incoming(@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

20 entries across 12 versions & 4 rubygems

Version Path
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide22-0.7.5 lib/ruby-debug-ide/commands/condition.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.7.3 lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.7.2 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.7.1.beta3 lib/ruby-debug-ide/commands/condition.rb
ruby-debug-ide-0.7.1.beta2 lib/ruby-debug-ide/commands/condition.rb