Class: Byebug::ThreadSwitchCommand

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

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

.namesObject



190
191
192
# File 'lib/byebug/commands/threads.rb', line 190

def names
  %w(thread)
end

Instance Method Details

#executeObject



176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/byebug/commands/threads.rb', line 176

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



172
173
174
# File 'lib/byebug/commands/threads.rb', line 172

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