Sha256: 3307056c286b8ab4952c26ee87a848ac24ff1ff1d7239313986a82a76e1eb1e7

Contents?: true

Size: 1.54 KB

Versions: 43

Compression:

Stored size: 1.54 KB

Contents

module Debugger
  class CatchCommand < Command # :nodoc:
    self.control = true

    def regexp
      /^\s* cat(?:ch)? 
           (?:\s+ (\S+))? 
           (?:\s+ (off))? \s* $/ix
    end

    def execute
      excn = @match[1] 
      if not excn
        # No args given.
        errmsg "Exception class must be specified for 'catch' command"
      elsif not @match[2]
        # One arg given.
        if 'off' == excn
          clear_catchpoints
        else
          Debugger.add_catchpoint(excn)
          print_catchpoint_set(excn)
        end
      elsif @match[2] != 'off'
        errmsg "Off expected. Got %s\n", @match[2]
      elsif remove_catchpoint(excn)
        print_catchpoint_deleted(excn)
      else
        errmsg "Catch for exception %s not found.\n", excn
      end
    end

    class << self
      def help_command
        'catch'
      end

      def help(cmd)
        %{
          cat[ch]\t\t\tshow catchpoint
          cat[ch] off \tremove all catch points
          cat[ch] <an Exception>\tset catchpoint to an exception
          cat[ch] <an Exception> off \tremove catchpoint for an exception
        }
      end
    end

    private

    def clear_catchpoints
      if Debugger.respond_to?(:clear_catchpoints)
        Debugger.clear_catchpoints
      else
        Debugger.catchpoints.clear
      end
    end

    def remove_catchpoint(excn)
      return Debugger.remove_catchpoint(excn) if Debugger.respond_to?(:remove_catchpoint)
      return Debugger.catchpoints.delete(excn) if Debugger.catchpoints.member?(excn)
      false
    end
  end
end

Version data entries

43 entries across 35 versions & 5 rubygems

Version Path
ruby-debug-ide-0.7.5 lib/ruby-debug-ide/commands/catchpoint.rb
avalara_sdk-24.12.2 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/commands/catchpoint.rb
avalara_sdk-24.12.1 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/commands/catchpoint.rb
avalara_sdk-24.12.0 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/commands/catchpoint.rb
ruby-debug-ide-0.7.4 lib/ruby-debug-ide/commands/catchpoint.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/commands/catchpoint.rb
ruby-debug-ide22-0.7.5 lib/ruby-debug-ide/commands/catchpoint.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/catchpoint.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/commands/catchpoint.rb
ruby-debug-ide-0.7.3 lib/ruby-debug-ide/commands/catchpoint.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/catchpoint.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/catchpoint.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/catchpoint.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/catchpoint.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/catchpoint.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/catchpoint.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/catchpoint.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/catchpoint.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/catchpoint.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/commands/catchpoint.rb