Class: Debugger::ThreadSwitchCommand

Inherits:
Command
  • Object
show all
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 inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



54
55
56
57
58
# File 'lib/ruby-debug/commands/threads.rb', line 54

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

.help_commandObject



50
51
52
# File 'lib/ruby-debug/commands/threads.rb', line 50

def help_command
  'thread'
end

Instance Method Details

#executeObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ruby-debug/commands/threads.rb', line 34

def execute
  c = get_context(@match[1].to_i)
  case
  when c == @state.context
    print_msg "It's the current thread."
  when c.ignored?
    print_msg "Can't switch to the debugger thread."
  else
    print_context(c)
    c.stop_next = 1
    c.thread.run
    @state.proceed
  end
end

#regexpObject



30
31
32
# File 'lib/ruby-debug/commands/threads.rb', line 30

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