Class: Debugger::DisableCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/enable.rb

Overview

:nodoc:

Constant Summary collapse

Subcommands =
[
   ['breakpoints', 1, "Disable some breakpoints",
"Arguments are breakpoint numbers with spaces in between.
A disabled breakpoint is not forgotten, but has no effect until reenabled."],
   ['display', 1, "Disable some display expressions when program stops",
"Arguments are the code numbers of the expressions to stop displaying.
Do \"info display\" to see current list of code numbers."],
  ].map do |name, min, short_help, long_help| 
  SubcmdStruct.new(name, min, short_help, long_help)
end

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(args) ⇒ Object



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/ruby-debug/commands/enable.rb', line 169

def help(args)
  if args[1] 
    s = args[1]
    subcmd = Subcommands.find do |try_subcmd| 
      (s.size >= try_subcmd.min) and
        (try_subcmd.name[0..s.size-1] == s)
    end
    if subcmd
      str = subcmd.short_help + '.'
      str += "\n" + subcmd.long_help if subcmd.long_help
      return str
    else
      return "Invalid 'disable' subcommand '#{args[1]}'."
    end
  end
  s = %{
    Disable some things.

    A disabled item is not forgotten, but has no effect until reenabled.
    Use the "enable" command to have it take effect again.
    -- 
    List of disable subcommands:
    --  
  }
  for subcmd in Subcommands do
    s += "disable #{subcmd.name} -- #{subcmd.short_help}\n"
  end
  return s
end

.help_commandObject



165
166
167
# File 'lib/ruby-debug/commands/enable.rb', line 165

def help_command
  'disable'
end

Instance Method Details

#disable_breakpoints(args) ⇒ Object



156
157
158
# File 'lib/ruby-debug/commands/enable.rb', line 156

def disable_breakpoints(args)
  enable_disable_breakpoints("Disable", args)
end

#disable_display(args) ⇒ Object



160
161
162
# File 'lib/ruby-debug/commands/enable.rb', line 160

def disable_display(args)
  enable_disable_display("Disable", args)
end

#executeObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/ruby-debug/commands/enable.rb', line 141

def execute
  if not @match[1]
    errmsg pr("toggle.errors.syntax", toggle: "disable")
  else
    args = @match[1].split(/[ \t]+/)
    param = args.shift
    subcmd = find(Subcommands, param)
    if subcmd
      send("disable_#{subcmd.name}", args)
    else
      send("disable_breakpoints", args.unshift(param))
    end
  end
end

#regexpObject



137
138
139
# File 'lib/ruby-debug/commands/enable.rb', line 137

def regexp
  /^\s* dis(?:able)? (?:\s+(.*))?$/ix
end