Class: Debugger::ShowCommand

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

Overview

Implements debugger “show” command.

Constant Summary collapse

Subcommands =
[
   ['annotate', 2, "Show annotation level",
"0 == normal; 2 == output annotated suitably for use by programs that control 
ruby-debug."],
   ['args', 2, 
    "Show argument list to give program being debugged when it is started",
"Follow this command with any number of args, to be passed to the program."],
   ['autoeval',  4, "Show if unrecognized command are evaluated"],
   ['autolist',  4, "Show if 'list' commands is run on breakpoints"],
   ['autoirb',   4, "Show if IRB is invoked on debugger stops"],
   ['autoreload', 4, "Show if source code is reloaded when changed"],
   ['basename',  1, "Show if basename used in reporting files"],
   ['callstyle', 2, "Show paramater style used showing call frames"],
   ['commands',  2, "Show the history of commands you typed",
"You can supply a command number to start with."],
   ['forcestep', 1, "Show if sure 'next/step' forces move to a new line"],
   ['fullpath',  2, "Show if full file names are displayed in frames"],
   ['history', 2, "Generic command for showing command history parameters",
"show history filename -- Show the filename in which to record the command history
show history save -- Show saving of the history record on exit
show history size -- Show the size of the command history"],
   ['keep-frame-bindings', 1, "Save frame binding on each call"],
   ['linetrace', 3, "Show line execution tracing"],
   ['linetrace+', 10, 
    "Show if consecutive lines should be different are shown in tracing"],
   ['listsize', 3, "Show number of source lines to list by default"],
   ['port', 3, "Show server port"],
   ['post-mortem', 3, "Show whether we go into post-mortem debugging on an uncaught exception"],
   ['trace', 1, 
    "Show if a stack trace is displayed when 'eval' raises exception"],
   ['version', 1, 
    "Show what version of the debugger this is"],
   ['width', 1, 
    "Show the number of characters the debugger thinks are in a line"],
  ].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



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/ruby-debug/commands/show.rb', line 204

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 'show' subcommand '#{args[1]}'."
    end
  end
  s = "
    Generic command for showing things about the debugger.

    -- 
    List of show subcommands:
    --  
  "
  for subcmd in Subcommands do
    s += "show #{subcmd.name} -- #{subcmd.short_help}\n"
  end
  return s
end

.help_commandObject



200
201
202
# File 'lib/ruby-debug/commands/show.rb', line 200

def help_command
  "show"
end

Instance Method Details

#executeObject



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/ruby-debug/commands/show.rb', line 183

def execute
  if !@match[1]
    subcommands = Subcommands.map { |s| "show #{s.name} -- #{s.short_help}" }.join("\n")
    print pr("show.errors.no_subcommand", subcommands: subcommands)
  else
    args = @match[1].split(/[ \t]+/)
    param = args.shift
    subcmd = find(Subcommands, param)
    if subcmd
      print show_setting(subcmd.name)
    else
      print pr("show.errors.unknown", name: param)
    end
  end
end

#regexpObject



179
180
181
# File 'lib/ruby-debug/commands/show.rb', line 179

def regexp
  /^show (?: \s+ (.+) )?$/xi
end