Class: LLDB::CompileUnit
- Inherits:
-
Object
- Object
- LLDB::CompileUnit
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/compile_unit.rb
Instance Method Summary collapse
- #file_spec ⇒ Object
-
#initialize(ptr, target: nil, context: nil) ⇒ CompileUnit
constructor
A new instance of CompileUnit.
- #line_entries ⇒ Object
- #line_entry_at_index(index) ⇒ Object
- #num_line_entries ⇒ Object
- #to_ptr ⇒ Object
- #valid? ⇒ Boolean
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(ptr, target: nil, context: nil) ⇒ CompileUnit
Returns a new instance of CompileUnit.
12 13 14 15 16 17 18 19 |
# File 'lib/lldb/compile_unit.rb', line 12 def initialize(ptr, target: nil, context: nil) @target = target initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_compile_unit_destroy(released) }, context: context || target&.context ) end |
Instance Method Details
#file_spec ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/lldb/compile_unit.rb', line 27 def file_spec return nil unless valid? ptr = FFIBindings.lldb_compile_unit_get_file_spec(@ptr) return nil if ptr.nil? || ptr.null? FileSpec.from_ptr(ptr, context: context) end |
#line_entries ⇒ Object
55 56 57 |
# File 'lib/lldb/compile_unit.rb', line 55 def line_entries (0...num_line_entries).map { |index| line_entry_at_index(index) }.compact end |
#line_entry_at_index(index) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/lldb/compile_unit.rb', line 45 def line_entry_at_index(index) return nil unless valid? ptr = FFIBindings.lldb_compile_unit_get_line_entry_at_index(@ptr, index) return nil if ptr.nil? || ptr.null? LineEntry.new(ptr, target: @target, context: context) end |
#num_line_entries ⇒ Object
37 38 39 40 41 |
# File 'lib/lldb/compile_unit.rb', line 37 def num_line_entries return 0 unless valid? FFIBindings.lldb_compile_unit_get_num_line_entries(@ptr) end |
#to_ptr ⇒ Object
60 61 62 |
# File 'lib/lldb/compile_unit.rb', line 60 def to_ptr @ptr end |
#valid? ⇒ Boolean
22 23 24 |
# File 'lib/lldb/compile_unit.rb', line 22 def valid? !@ptr.null? && FFIBindings.lldb_compile_unit_is_valid(@ptr) != 0 end |