Class: LLDB::Event

Inherits:
Object
  • Object
show all
Includes:
NativeLifecycle
Defined in:
lib/lldb/event.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NativeLifecycle

#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object

Constructor Details

#initialize(pointer, context: nil) ⇒ Event

Returns a new instance of Event.

RBS:

  • context: Context?

  • pointer: FFI::Pointer

  • return: void



12
13
14
15
16
17
18
# File 'lib/lldb/event.rb', line 12

def initialize(pointer, context: nil)
  initialize_native_object(
    pointer,
    release: ->(released) { FFIBindings.lldb_event_destroy(released) },
    context: context
  )
end

Class Method Details

.from_ptr(ptr, context: nil) ⇒ Object

RBS:

  • ptr: FFI::Pointer

  • context: Context?

  • return: Event



23
24
25
# File 'lib/lldb/event.rb', line 23

def self.from_ptr(ptr, context: nil)
  new(ptr, context: context)
end

Instance Method Details

#broadcasterObject

RBS:

  • return: Broadcaster?



63
64
65
66
67
68
69
70
# File 'lib/lldb/event.rb', line 63

def broadcaster
  return nil unless valid?

  broadcaster_ptr = FFIBindings.lldb_event_get_broadcaster(@ptr)
  return nil if broadcaster_ptr.nil? || broadcaster_ptr.null?

  Broadcaster.from_ptr(broadcaster_ptr, context: context)
end

#broadcaster_classObject

RBS:

  • return: String?



47
48
49
50
51
# File 'lib/lldb/event.rb', line 47

def broadcaster_class
  return nil unless valid?

  FFIBindings.lldb_event_get_broadcaster_class(@ptr)
end

#data_flavorObject

RBS:

  • return: String?



40
41
42
43
44
# File 'lib/lldb/event.rb', line 40

def data_flavor
  return nil unless valid?

  FFIBindings.lldb_event_get_data_flavor(@ptr)
end

#descriptionObject

RBS:

  • return: String



54
55
56
57
58
59
60
# File 'lib/lldb/event.rb', line 54

def description
  return '' unless valid?

  NativeBuffer.read_c_string do |buffer, length|
    FFIBindings.lldb_event_get_description(@ptr, buffer, length)
  end
end

#interrupted?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


100
101
102
# File 'lib/lldb/event.rb', line 100

def interrupted?
  valid? && FFIBindings.lldb_event_get_interrupted(@ptr) != 0
end

#processObject

RBS:

  • return: Process?



85
86
87
88
89
90
91
92
# File 'lib/lldb/event.rb', line 85

def process
  return nil unless process_event?

  process_ptr = FFIBindings.lldb_event_get_process(@ptr)
  return nil if process_ptr.nil? || process_ptr.null?

  Process.new(process_ptr, target: nil, context: context)
end

#process_event?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


73
74
75
# File 'lib/lldb/event.rb', line 73

def process_event?
  valid? && FFIBindings.lldb_event_is_process_event(@ptr) != 0
end

#process_stateObject

RBS:

  • return: Integer



78
79
80
81
82
# File 'lib/lldb/event.rb', line 78

def process_state
  return State::INVALID unless valid?

  FFIBindings.lldb_event_get_process_state(@ptr)
end

#restarted?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


95
96
97
# File 'lib/lldb/event.rb', line 95

def restarted?
  valid? && FFIBindings.lldb_event_get_restarted(@ptr) != 0
end

#to_ptrObject

RBS:

  • return: FFI::Pointer



105
106
107
# File 'lib/lldb/event.rb', line 105

def to_ptr
  @ptr
end

#typeObject

RBS:

  • return: Integer



33
34
35
36
37
# File 'lib/lldb/event.rb', line 33

def type
  return 0 unless valid?

  FFIBindings.lldb_event_get_type(@ptr)
end

#valid?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


28
29
30
# File 'lib/lldb/event.rb', line 28

def valid?
  !@ptr.null? && FFIBindings.lldb_event_is_valid(@ptr) != 0
end