Class: LLDB::Type
Class Method Summary collapse
Instance Method Summary collapse
- #array_element_type ⇒ Object
- #array_size ⇒ Object
- #array_type? ⇒ Boolean
- #basic_type ⇒ Object
- #byte_size ⇒ Object
- #canonical_type ⇒ Object
- #dereferenced_type ⇒ Object
- #direct_base_class_at_index(index) ⇒ Object
- #display_type_name ⇒ Object
- #field_at_index(index) ⇒ Object
- #function_type? ⇒ Boolean
-
#initialize(ptr, context: nil) ⇒ Type
constructor
A new instance of Type.
- #inspect ⇒ Object
- #name ⇒ Object
- #num_direct_base_classes ⇒ Object
- #num_fields ⇒ Object
- #num_virtual_base_classes ⇒ Object
- #pointee_type ⇒ Object
- #pointer_type ⇒ Object
- #pointer_type? ⇒ Boolean
- #polymorphic_class? ⇒ Boolean
- #reference_type ⇒ Object
- #reference_type? ⇒ Boolean
- #to_ptr ⇒ Object
- #to_s ⇒ Object
- #typedef_type? ⇒ Boolean
- #unqualified_type ⇒ Object
- #valid? ⇒ Boolean
- #vector_type? ⇒ Boolean
- #virtual_base_class_at_index(index) ⇒ Object
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(ptr, context: nil) ⇒ Type
Returns a new instance of Type.
11 12 13 14 15 16 17 |
# File 'lib/lldb/type.rb', line 11 def initialize(ptr, context: nil) initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_type_destroy(released) }, context: context ) end |
Class Method Details
.release(ptr) ⇒ Object
21 22 23 |
# File 'lib/lldb/type.rb', line 21 def self.release(ptr) ->(_id) { FFIBindings.lldb_type_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#array_element_type ⇒ Object
161 162 163 164 165 166 167 168 |
# File 'lib/lldb/type.rb', line 161 def array_element_type raise InvalidObjectError, 'Type is not valid' unless valid? ptr = FFIBindings.lldb_type_get_array_element_type(@ptr) return nil if ptr.nil? || ptr.null? Type.new(ptr) end |
#array_size ⇒ Object
171 172 173 174 175 |
# File 'lib/lldb/type.rb', line 171 def array_size return 0 unless valid? FFIBindings.lldb_type_get_array_size(@ptr) end |
#array_type? ⇒ Boolean
66 67 68 69 70 |
# File 'lib/lldb/type.rb', line 66 def array_type? return false unless valid? FFIBindings.lldb_type_is_array_type(@ptr) != 0 end |
#basic_type ⇒ Object
217 218 219 220 221 |
# File 'lib/lldb/type.rb', line 217 def basic_type return BasicType::INVALID unless valid? FFIBindings.lldb_type_get_basic_type(@ptr) end |
#byte_size ⇒ Object
45 46 47 48 49 |
# File 'lib/lldb/type.rb', line 45 def byte_size return 0 unless valid? FFIBindings.lldb_type_get_byte_size(@ptr) end |
#canonical_type ⇒ Object
151 152 153 154 155 156 157 158 |
# File 'lib/lldb/type.rb', line 151 def canonical_type raise InvalidObjectError, 'Type is not valid' unless valid? ptr = FFIBindings.lldb_type_get_canonical_type(@ptr) return nil if ptr.nil? || ptr.null? Type.new(ptr) end |
#dereferenced_type ⇒ Object
131 132 133 134 135 136 137 138 |
# File 'lib/lldb/type.rb', line 131 def dereferenced_type raise InvalidObjectError, 'Type is not valid' unless valid? ptr = FFIBindings.lldb_type_get_dereferenced_type(@ptr) return nil if ptr.nil? || ptr.null? Type.new(ptr) end |
#direct_base_class_at_index(index) ⇒ Object
206 207 208 |
# File 'lib/lldb/type.rb', line 206 def direct_base_class_at_index(index) member_at(index, :lldb_type_get_direct_base_class_at_index) end |
#display_type_name ⇒ Object
38 39 40 41 42 |
# File 'lib/lldb/type.rb', line 38 def display_type_name return nil unless valid? FFIBindings.lldb_type_get_display_type_name(@ptr) end |
#field_at_index(index) ⇒ Object
200 201 202 |
# File 'lib/lldb/type.rb', line 200 def field_at_index(index) member_at(index, :lldb_type_get_field_at_index) end |
#function_type? ⇒ Boolean
87 88 89 90 91 |
# File 'lib/lldb/type.rb', line 87 def function_type? return false unless valid? FFIBindings.lldb_type_is_function_type(@ptr) != 0 end |
#inspect ⇒ Object
229 230 231 |
# File 'lib/lldb/type.rb', line 229 def inspect "#<LLDB::Type name=#{name.inspect} byte_size=#{byte_size}>" end |
#name ⇒ Object
31 32 33 34 35 |
# File 'lib/lldb/type.rb', line 31 def name return nil unless valid? FFIBindings.lldb_type_get_name(@ptr) end |
#num_direct_base_classes ⇒ Object
185 186 187 188 189 |
# File 'lib/lldb/type.rb', line 185 def num_direct_base_classes return 0 unless valid? FFIBindings.lldb_type_get_num_direct_base_classes(@ptr) end |
#num_fields ⇒ Object
178 179 180 181 182 |
# File 'lib/lldb/type.rb', line 178 def num_fields return 0 unless valid? FFIBindings.lldb_type_get_num_fields(@ptr) end |
#num_virtual_base_classes ⇒ Object
192 193 194 195 196 |
# File 'lib/lldb/type.rb', line 192 def num_virtual_base_classes return 0 unless valid? FFIBindings.lldb_type_get_num_virtual_base_classes(@ptr) end |
#pointee_type ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/lldb/type.rb', line 111 def pointee_type raise InvalidObjectError, 'Type is not valid' unless valid? ptr = FFIBindings.lldb_type_get_pointee_type(@ptr) return nil if ptr.nil? || ptr.null? Type.new(ptr) end |
#pointer_type ⇒ Object
101 102 103 104 105 106 107 108 |
# File 'lib/lldb/type.rb', line 101 def pointer_type raise InvalidObjectError, 'Type is not valid' unless valid? ptr = FFIBindings.lldb_type_get_pointer_type(@ptr) return nil if ptr.nil? || ptr.null? Type.new(ptr) end |
#pointer_type? ⇒ Boolean
52 53 54 55 56 |
# File 'lib/lldb/type.rb', line 52 def pointer_type? return false unless valid? FFIBindings.lldb_type_is_pointer_type(@ptr) != 0 end |
#polymorphic_class? ⇒ Boolean
94 95 96 97 98 |
# File 'lib/lldb/type.rb', line 94 def polymorphic_class? return false unless valid? FFIBindings.lldb_type_is_polymorphic_class(@ptr) != 0 end |
#reference_type ⇒ Object
121 122 123 124 125 126 127 128 |
# File 'lib/lldb/type.rb', line 121 def reference_type raise InvalidObjectError, 'Type is not valid' unless valid? ptr = FFIBindings.lldb_type_get_reference_type(@ptr) return nil if ptr.nil? || ptr.null? Type.new(ptr) end |
#reference_type? ⇒ Boolean
59 60 61 62 63 |
# File 'lib/lldb/type.rb', line 59 def reference_type? return false unless valid? FFIBindings.lldb_type_is_reference_type(@ptr) != 0 end |
#to_ptr ⇒ Object
234 235 236 |
# File 'lib/lldb/type.rb', line 234 def to_ptr @ptr end |
#to_s ⇒ Object
224 225 226 |
# File 'lib/lldb/type.rb', line 224 def to_s display_type_name || name || '(unknown type)' end |
#typedef_type? ⇒ Boolean
80 81 82 83 84 |
# File 'lib/lldb/type.rb', line 80 def typedef_type? return false unless valid? FFIBindings.lldb_type_is_typedef_type(@ptr) != 0 end |
#unqualified_type ⇒ Object
141 142 143 144 145 146 147 148 |
# File 'lib/lldb/type.rb', line 141 def unqualified_type raise InvalidObjectError, 'Type is not valid' unless valid? ptr = FFIBindings.lldb_type_get_unqualified_type(@ptr) return nil if ptr.nil? || ptr.null? Type.new(ptr) end |
#valid? ⇒ Boolean
26 27 28 |
# File 'lib/lldb/type.rb', line 26 def valid? !@ptr.null? && FFIBindings.lldb_type_is_valid(@ptr) != 0 end |
#vector_type? ⇒ Boolean
73 74 75 76 77 |
# File 'lib/lldb/type.rb', line 73 def vector_type? return false unless valid? FFIBindings.lldb_type_is_vector_type(@ptr) != 0 end |
#virtual_base_class_at_index(index) ⇒ Object
212 213 214 |
# File 'lib/lldb/type.rb', line 212 def virtual_base_class_at_index(index) member_at(index, :lldb_type_get_virtual_base_class_at_index) end |