Class: Debugger::ThreadSwitchCommand

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

Overview

Thread switch Must come after “Thread resume” because “switch” is optional

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, 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(cmd) ⇒ Object



169
170
171
172
173
# File 'lib/ruby-debug/commands/threads.rb', line 169

def help(cmd)
  %{
    th[read] [sw[itch]] <nnn>\tswitch thread context to nnn
  }
end

.help_commandObject



165
166
167
# File 'lib/ruby-debug/commands/threads.rb', line 165

def help_command
  'thread'
end

Instance Method Details

#executeObject



155
156
157
158
159
160
161
162
# File 'lib/ruby-debug/commands/threads.rb', line 155

def execute
  c = parse_thread_num_for_cmd("thread switch", @match[1])
  return unless c 
  display_context(c)
  c.stop_next = 1
  c.thread.run
  @state.proceed
end

#regexpObject



151
152
153
# File 'lib/ruby-debug/commands/threads.rb', line 151

def regexp
  /^\s*th(?:read)?\s*(?:sw(?:itch)?)?\s+(\S+)\s*$/
end