Class: Debugger::ThreadStopCommand

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

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ThreadFunctions

#debugger_thread?, #display_context

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



112
113
114
115
116
# File 'lib/ruby-debug/commands/threads.rb', line 112

def help(cmd)
  %{
    th[read] stop <nnn>\t\tstop thread nnn
  }
end

.help_commandObject



108
109
110
# File 'lib/ruby-debug/commands/threads.rb', line 108

def help_command
  'thread'
end

Instance Method Details

#executeObject



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/ruby-debug/commands/threads.rb', line 92

def execute
  c = get_context(@match[1].to_i)
  case
  when c == @state.context
    print "It's the current thread.\n"
  when debugger_thread?(c)
    print "Can't stop the debugger thread.\n"
  when c.thread.stop?
    print "Already stopped.\n"
  else
    display_context(c)
    c.set_suspend
  end
end

#regexpObject



88
89
90
# File 'lib/ruby-debug/commands/threads.rb', line 88

def regexp
  /^\s*th(?:read)?\s+stop\s+(\d+)\s*$/
end