Class: LLDB::Module
- Inherits:
-
Object
- Object
- LLDB::Module
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/module.rb
Instance Attribute Summary collapse
- #target ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #file ⇒ Object
- #file_path ⇒ Object
-
#initialize(ptr, target:, context: target&.context) ⇒ Module
constructor
A new instance of Module.
- #num_symbols ⇒ Object
- #platform_file ⇒ Object
- #platform_file_path ⇒ Object
- #symbol_at_index(index) ⇒ Object
- #symbols ⇒ Object
- #to_ptr ⇒ Object
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(ptr, target:, context: target&.context) ⇒ Module
Returns a new instance of Module.
15 16 17 18 19 20 21 22 |
# File 'lib/lldb/module.rb', line 15 def initialize(ptr, target:, context: target&.context) @target = target initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_module_destroy(released) }, context: context ) end |
Instance Attribute Details
#target ⇒ Object (readonly)
10 11 12 |
# File 'lib/lldb/module.rb', line 10 def target @target end |
Class Method Details
.release(ptr) ⇒ Object
26 27 28 |
# File 'lib/lldb/module.rb', line 26 def self.release(ptr) ->(_id) { FFIBindings.lldb_module_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#file ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/lldb/module.rb', line 50 def file return nil unless valid? file_ptr = FFIBindings.lldb_module_get_file(@ptr) return nil if file_ptr.nil? || file_ptr.null? FileSpec.from_ptr(file_ptr, context: context) end |
#file_path ⇒ Object
36 37 38 39 40 |
# File 'lib/lldb/module.rb', line 36 def file_path return nil unless valid? file&.path end |
#num_symbols ⇒ Object
70 71 72 73 74 |
# File 'lib/lldb/module.rb', line 70 def num_symbols return 0 unless valid? FFIBindings.lldb_module_get_num_symbols(@ptr) end |
#platform_file ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/lldb/module.rb', line 60 def platform_file return nil unless valid? file_ptr = FFIBindings.lldb_module_get_platform_file(@ptr) return nil if file_ptr.nil? || file_ptr.null? FileSpec.from_ptr(file_ptr, context: context) end |
#platform_file_path ⇒ Object
43 44 45 46 47 |
# File 'lib/lldb/module.rb', line 43 def platform_file_path return nil unless valid? platform_file&.path end |
#symbol_at_index(index) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/lldb/module.rb', line 78 def symbol_at_index(index) raise InvalidObjectError, 'Module is not valid' unless valid? symbol_ptr = FFIBindings.lldb_module_get_symbol_at_index(@ptr, index) return nil if symbol_ptr.nil? || symbol_ptr.null? Symbol.new(symbol_ptr, target: @target, context: context) end |
#symbols ⇒ Object
88 89 90 |
# File 'lib/lldb/module.rb', line 88 def symbols (0...num_symbols).map { |index| symbol_at_index(index) }.compact end |
#to_ptr ⇒ Object
98 99 100 |
# File 'lib/lldb/module.rb', line 98 def to_ptr @ptr end |
#to_s ⇒ Object
93 94 95 |
# File 'lib/lldb/module.rb', line 93 def to_s file_path || '(unknown module)' end |
#valid? ⇒ Boolean
31 32 33 |
# File 'lib/lldb/module.rb', line 31 def valid? !@ptr.null? && FFIBindings.lldb_module_is_valid(@ptr) != 0 end |