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



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

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

.help_commandObject



110
111
112
# File 'lib/ruby-debug/commands/threads.rb', line 110

def help_command
  'thread'
end

Instance Method Details

#executeObject



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

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"
  else
    c.suspend
    display_context(c)
  end
end

#regexpObject



92
93
94
# File 'lib/ruby-debug/commands/threads.rb', line 92

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