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, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



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

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



59
60
61
# File 'lib/ruby-debug/commands/control.rb', line 59

def help_command
  'restart'
end

Instance Method Details

#executeObject



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

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



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

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