Module: LLDB

Defined in:
lib/lldb/type.rb,
lib/lldb.rb,
lib/lldb/block.rb,
lib/lldb/error.rb,
lib/lldb/event.rb,
lib/lldb/frame.rb,
lib/lldb/types.rb,
lib/lldb/value.rb,
lib/lldb/module.rb,
lib/lldb/native.rb,
lib/lldb/symbol.rb,
lib/lldb/target.rb,
lib/lldb/thread.rb,
lib/lldb/address.rb,
lib/lldb/context.rb,
lib/lldb/process.rb,
lib/lldb/version.rb,
lib/lldb/debugger.rb,
lib/lldb/function.rb,
lib/lldb/listener.rb,
lib/lldb/file_spec.rb,
lib/lldb/breakpoint.rb,
lib/lldb/line_entry.rb,
lib/lldb/value_list.rb,
lib/lldb/watchpoint.rb,
lib/lldb/api_support.rb,
lib/lldb/attach_info.rb,
lib/lldb/broadcaster.rb,
lib/lldb/instruction.rb,
lib/lldb/launch_info.rb,
lib/lldb/type_member.rb,
lib/lldb/compile_unit.rb,
lib/lldb/ffi_bindings.rb,
lib/lldb/native_buffer.rb,
lib/lldb/native_handle.rb,
lib/lldb/file_spec_list.rb,
lib/lldb/symbol_context.rb,
lib/lldb/instruction_list.rb,
lib/lldb/native_lifecycle.rb,
lib/lldb/expression_options.rb,
lib/lldb/memory_region_info.rb,
lib/lldb/breakpoint_location.rb,
lib/lldb/command_interpreter.rb,
lib/lldb/native_string_array.rb,
lib/lldb/command_return_object.rb,
sig/lldb/ffi_bindings.rbs,
ext/lldb/discovery.rb

Overview

rbs_inline: enabled

Defined Under Namespace

Modules: APISupport, BasicType, BuildDiscovery, DynamicValue, ErrorType, FFIBindings, LaunchFlags, Native, NativeBuffer, NativeLifecycle, NativeStatus, ReturnStatus, RunMode, State, StopReason, SymbolContextItem, ValueType Classes: Address, AttachError, AttachInfo, Block, Breakpoint, BreakpointError, BreakpointLocation, Broadcaster, ClosedObjectError, CommandInterpreter, CommandReturnObject, CompileUnit, Context, Debugger, Error, EvaluationError, Event, ExpressionOptions, FileSpec, FileSpecList, Frame, Function, IncompatibleWrapperError, Instruction, InstructionList, InternalBindingError, InvalidObjectError, LLDBError, LaunchError, LaunchInfo, LifecycleError, LineEntry, Listener, MemoryRegionInfo, Module, NativeHandle, NativeStringArray, OperationError, Process, Symbol, SymbolContext, Target, Thread, Type, TypeMember, UnsupportedAPIError, UnsupportedPlatformError, Value, ValueList, Watchpoint

Constant Summary collapse

INVALID_ADDRESS =

: Integer

(1 << 64) - 1
INVALID_PROCESS_ID =

: Integer

0
INVALID_THREAD_ID =

: Integer

0
INVALID_BREAK_ID =

: Integer

0
INVALID_LINE_NUMBER =

: Integer

0xFFFFFFFF
VERSION =

: String

'0.3.0'

Class Method Summary collapse

Class Method Details

.create_debugger(source_init_files: false) ⇒ Object

RBS:

  • return: Debugger



92
93
94
95
# File 'lib/lldb.rb', line 92

def create_debugger(source_init_files: false)
  LLDB.initialize
  Debugger.create(source_init_files: source_init_files)
end

.ensure_initialized!Object

RBS:

  • return: void

Raises:



85
86
87
88
89
# File 'lib/lldb.rb', line 85

def ensure_initialized!
  return if initialized?

  raise LLDBError, 'LLDB has not been initialized. Call LLDB.initialize first.'
end

.initializeObject

RBS:

  • return: void



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/lldb.rb', line 53

def initialize
  lifecycle_mutex.synchronize do
    return if @initialized

    error = Error.new
    status = FFIBindings.lldb_initialize(error.to_ptr)
    Native.check_status!(status, 'lldb.initialize', error)
    @initialized = true

    at_exit { terminate if open_debugger_count.zero? }
  end
end

.initialized?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


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

def initialized?
  @initialized == true
end

.open_debugger_countObject

RBS:

  • return: Integer



98
99
100
# File 'lib/lldb.rb', line 98

def open_debugger_count
  lifecycle_mutex.synchronize { live_debugger_count }
end

.register_debugger(debugger) ⇒ Object

RBS:

  • debugger: Debugger

  • return: void



104
105
106
107
108
109
# File 'lib/lldb.rb', line 104

def register_debugger(debugger)
  lifecycle_mutex.synchronize do
    debuggers = (@debuggers ||= []) # : Array[WeakRef]
    debuggers << WeakRef.new(debugger)
  end
end

.terminateObject

RBS:

  • return: void



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/lldb.rb', line 67

def terminate
  lifecycle_mutex.synchronize do
    return unless @initialized
    if live_debugger_count.positive?
      raise LifecycleError, 'cannot terminate LLDB while debuggers are open'
    end

    FFIBindings.lldb_terminate
    @initialized = false
  end
end