Class: Debugger::RestartCommand

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

Overview

:nodoc:

Constant Summary

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

Constructor Details

This class inherits a constructor from Debugger::Command

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/ruby-debug/commands/control.rb', line 65

def help(cmd)
  %{
    restart|R [args] 
    Restart the program. This is is a re-exec - all debugger state
    is lost. If command arguments are passed those are used.
  }
end

.help_commandObject



61
62
63
# File 'lib/ruby-debug/commands/control.rb', line 61

def help_command
  'restart'
end

Instance Method Details

#executeObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ruby-debug/commands/control.rb', line 43

def execute
  if not defined? Debugger::RDEBUG_SCRIPT or not defined? Debugger::ARGV
    print "We are not in a context we can restart from.\n"
    return
  end
  if @match[2]
    args = Debugger::PROG_SCRIPT + " " + @match[2]
  else
    args = Debugger::ARGV.join(" ")
  end

  # An execv would be preferable to the "exec" below.
  cmd = Debugger::RDEBUG_SCRIPT + " " + args
  print "Re exec'ing:\n\t#{cmd}\n"
  exec cmd
end

#regexpObject



35
36
37
38
39
40
41
# File 'lib/ruby-debug/commands/control.rb', line 35

def regexp
  / ^\s*
  (restart|R)
  (\s+ \S+ .*)?
  $
  /x
end