Class: Byebug::ThreadSwitchCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/threads.rb

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



198
199
200
# File 'lib/byebug/commands/threads.rb', line 198

def description
  %{th[read] [sw[itch]] <nnn>\tswitch thread context to nnn}
end

.namesObject



194
195
196
# File 'lib/byebug/commands/threads.rb', line 194

def names
  %w(thread)
end

Instance Method Details

#executeObject



180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/byebug/commands/threads.rb', line 180

def execute
  if @match[1] =~ /switch/
    errmsg '"thread switch" needs a thread number'
    return
  end
  c = parse_thread_num_for_cmd('thread switch', @match[1])
  return unless c
  display_context(c)
  c.step_into 1
  c.thread.run
  @state.proceed
end

#regexpObject



176
177
178
# File 'lib/byebug/commands/threads.rb', line 176

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