Class: Twib::Switch::Debug::Event::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/twib/switch/debug.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags, thread_id, specific) ⇒ Event

Returns a new instance of Event.



23
24
25
26
27
# File 'lib/twib/switch/debug.rb', line 23

def initialize(flags, thread_id, specific)
  @flags = flags
  @thread_id = thread_id
  unpack_specific(specific)
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



28
29
30
# File 'lib/twib/switch/debug.rb', line 28

def flags
  @flags
end

#thread_idObject (readonly)

Returns the value of attribute thread_id.



29
30
31
# File 'lib/twib/switch/debug.rb', line 29

def thread_id
  @thread_id
end

Class Method Details

.unpack(pack) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/twib/switch/debug.rb', line 6

def self.unpack(pack)
  event_type, flags, thread_id, specific = pack.unpack("L<L<Q<a*")
  case event_type
  when AttachProcess::TYPE
    return AttachProcess.new(flags, thread_id, specific)
  when AttachThread::TYPE
    return AttachThread.new(flags, thread_id, specific)
  when ExitProcess::TYPE
    return ExitProcess.new(flags, thread_id, specific)
  when ExitThread::TYPE
    return ExitThread.new(flags, thread_id, specific)
  when Exception::TYPE
    return Exception.new(flags, thread_id, specific)
  else
    raise "unknown debug event type: #{event_type}"
  end
end