Class: LLDB::Listener

Inherits:
Object
  • Object
show all
Includes:
NativeLifecycle
Defined in:
lib/lldb/listener.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(name = nil, context: nil, pointer: nil) ⇒ Listener

Returns a new instance of Listener.

RBS:

  • name: String?

  • context: Context?

  • pointer: FFI::Pointer?

  • return: void



13
14
15
16
17
18
19
20
# File 'lib/lldb/listener.rb', line 13

def initialize(name = nil, context: nil, pointer: nil)
  ptr = pointer || FFIBindings.lldb_listener_create(name)
  initialize_native_object(
    ptr,
    release: ->(released) { FFIBindings.lldb_listener_destroy(released) },
    context: context
  )
end

Class Method Details

.from_ptr(ptr, context: nil) ⇒ Object

RBS:

  • ptr: FFI::Pointer

  • context: Context?

  • return: Listener



25
26
27
# File 'lib/lldb/listener.rb', line 25

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

Instance Method Details

#next_eventObject

RBS:

  • return: Event?



66
67
68
69
# File 'lib/lldb/listener.rb', line 66

def next_event
  ensure_open!
  event_from_ptr(FFIBindings.lldb_listener_next_event(@ptr))
end

#peek_eventObject

RBS:

  • return: Event?



60
61
62
63
# File 'lib/lldb/listener.rb', line 60

def peek_event
  ensure_open!
  event_from_ptr(FFIBindings.lldb_listener_peek_event(@ptr))
end

#start_listening_for_events(broadcaster, event_mask) ⇒ Object

RBS:

  • broadcaster: Broadcaster

  • event_mask: Integer

  • return: Integer



37
38
39
40
# File 'lib/lldb/listener.rb', line 37

def start_listening_for_events(broadcaster, event_mask)
  ensure_open!
  FFIBindings.lldb_listener_start_listening_for_events(@ptr, broadcaster.to_ptr, event_mask)
end

#stop_listening_for_events(broadcaster, event_mask) ⇒ Object

RBS:

  • broadcaster: Broadcaster

  • event_mask: Integer

  • return: bool



45
46
47
48
# File 'lib/lldb/listener.rb', line 45

def stop_listening_for_events(broadcaster, event_mask)
  ensure_open!
  FFIBindings.lldb_listener_stop_listening_for_events(@ptr, broadcaster.to_ptr, event_mask) != 0
end

#to_ptrObject

RBS:

  • return: FFI::Pointer



72
73
74
# File 'lib/lldb/listener.rb', line 72

def to_ptr
  @ptr
end

#valid?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


30
31
32
# File 'lib/lldb/listener.rb', line 30

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

#wait_for_event(timeout_seconds: 0) ⇒ Object

RBS:

  • timeout_seconds: Integer

  • return: Event?



52
53
54
55
56
57
# File 'lib/lldb/listener.rb', line 52

def wait_for_event(timeout_seconds: 0)
  ensure_open!
  timeout = normalize_timeout(timeout_seconds)
  event_ptr = FFIBindings.lldb_listener_wait_for_event(@ptr, timeout)
  event_from_ptr(event_ptr)
end