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



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

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

.help_commandObject



154
155
156
# File 'lib/ruby-debug/commands/threads.rb', line 154

def help_command
  'thread'
end

Instance Method Details

#executeObject



144
145
146
147
148
149
150
151
# File 'lib/ruby-debug/commands/threads.rb', line 144

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



140
141
142
# File 'lib/ruby-debug/commands/threads.rb', line 140

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