Class: LLDB::Frame
- Inherits:
-
Object
- Object
- LLDB::Frame
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/frame.rb
Instance Attribute Summary collapse
- #thread ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #block ⇒ Object
- #column ⇒ Object
- #compile_unit ⇒ Object
- #disassemble ⇒ Object
- #display_function_name ⇒ Object
- #evaluate_expression(expression, options: nil) ⇒ Object
- #file_path ⇒ Object
- #file_spec ⇒ Object
- #find_variable(name) ⇒ Object
- #fp ⇒ Object
- #frame_id ⇒ Object (also: #id)
- #function ⇒ Object
- #function_name ⇒ Object
- #get_module ⇒ Object
- #get_registers ⇒ Object
- #get_thread ⇒ Object
- #get_value_for_variable_path(path) ⇒ Object
- #get_variables(arguments: true, locals: true, statics: true, in_scope_only: true) ⇒ Object
-
#initialize(ptr, thread:, context: thread.context) ⇒ Frame
constructor
A new instance of Frame.
- #inlined? ⇒ Boolean
- #instruction_list ⇒ Object (also: #instructions)
- #line ⇒ Object
- #line_entry ⇒ Object
- #location ⇒ Object
- #pc ⇒ Object
- #pc=(value) ⇒ Object
- #sp ⇒ Object
- #symbol ⇒ Object
- #symbol_context(scope = SymbolContextItem::EVERYTHING) ⇒ 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, thread:, context: thread.context) ⇒ Frame
Returns a new instance of Frame.
15 16 17 18 19 20 21 22 |
# File 'lib/lldb/frame.rb', line 15 def initialize(ptr, thread:, context: thread.context) @thread = thread initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_frame_destroy(released) }, context: context ) end |
Instance Attribute Details
#thread ⇒ Object (readonly)
10 11 12 |
# File 'lib/lldb/frame.rb', line 10 def thread @thread end |
Class Method Details
.release(ptr) ⇒ Object
26 27 28 |
# File 'lib/lldb/frame.rb', line 26 def self.release(ptr) ->(_id) { FFIBindings.lldb_frame_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#block ⇒ Object
115 116 117 118 119 120 121 122 |
# File 'lib/lldb/frame.rb', line 115 def block raise InvalidObjectError, 'Frame is not valid' unless valid? block_ptr = FFIBindings.lldb_frame_get_block(@ptr) return nil if block_ptr.nil? || block_ptr.null? Block.new(block_ptr, target: @thread.process.target, context: context) end |
#column ⇒ Object
125 126 127 128 129 |
# File 'lib/lldb/frame.rb', line 125 def column return 0 unless valid? FFIBindings.lldb_frame_get_column(@ptr) end |
#compile_unit ⇒ Object
105 106 107 108 109 110 111 112 |
# File 'lib/lldb/frame.rb', line 105 def compile_unit raise InvalidObjectError, 'Frame is not valid' unless valid? unit_ptr = FFIBindings.lldb_frame_get_compile_unit(@ptr) return nil if unit_ptr.nil? || unit_ptr.null? CompileUnit.new(unit_ptr, target: @thread.process.target, context: context) end |
#disassemble ⇒ Object
275 276 277 278 279 |
# File 'lib/lldb/frame.rb', line 275 def disassemble raise InvalidObjectError, 'Frame is not valid' unless valid? FFIBindings.lldb_frame_disassemble(@ptr) end |
#display_function_name ⇒ Object
43 44 45 46 47 |
# File 'lib/lldb/frame.rb', line 43 def display_function_name raise InvalidObjectError, 'Frame is not valid' unless valid? FFIBindings.lldb_frame_get_display_function_name(@ptr) end |
#evaluate_expression(expression, options: nil) ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/lldb/frame.rb', line 176 def evaluate_expression(expression, options: nil) raise InvalidObjectError, 'Frame is not valid' unless valid? APISupport.require_method!(:lldb_frame_evaluate_expression, 'evaluate_expression') value_ptr = if unless .is_a?(ExpressionOptions) raise ArgumentError, 'options must be an ExpressionOptions' end FFIBindings.( @ptr, expression, .to_ptr ) else FFIBindings.lldb_frame_evaluate_expression(@ptr, expression) end return nil if value_ptr.nil? || value_ptr.null? Value.new(value_ptr, parent: self, context: context) end |
#file_path ⇒ Object
57 58 59 60 61 |
# File 'lib/lldb/frame.rb', line 57 def file_path raise InvalidObjectError, 'Frame is not valid' unless valid? file_spec&.path end |
#file_spec ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/lldb/frame.rb', line 64 def file_spec raise InvalidObjectError, 'Frame is not valid' unless valid? file_ptr = FFIBindings.lldb_frame_get_file_spec(@ptr) return nil if file_ptr.nil? || file_ptr.null? FileSpec.from_ptr(file_ptr, context: context) end |
#find_variable(name) ⇒ Object
163 164 165 166 167 168 169 170 171 |
# File 'lib/lldb/frame.rb', line 163 def find_variable(name) raise InvalidObjectError, 'Frame is not valid' unless valid? APISupport.require_method!(:lldb_frame_find_variable, 'find_variable') value_ptr = FFIBindings.lldb_frame_find_variable(@ptr, name) return nil if value_ptr.nil? || value_ptr.null? Value.new(value_ptr, parent: self, context: context) end |
#fp ⇒ Object
146 147 148 149 150 |
# File 'lib/lldb/frame.rb', line 146 def fp return INVALID_ADDRESS unless valid? FFIBindings.lldb_frame_get_fp(@ptr) end |
#frame_id ⇒ Object Also known as: id
153 154 155 156 157 |
# File 'lib/lldb/frame.rb', line 153 def frame_id return 0 unless valid? FFIBindings.lldb_frame_get_frame_id(@ptr) end |
#function ⇒ Object
85 86 87 88 89 90 91 92 |
# File 'lib/lldb/frame.rb', line 85 def function raise InvalidObjectError, 'Frame is not valid' unless valid? function_ptr = FFIBindings.lldb_frame_get_function(@ptr) return nil if function_ptr.nil? || function_ptr.null? Function.new(function_ptr, target: @thread.process.target, context: context) end |
#function_name ⇒ Object
36 37 38 39 40 |
# File 'lib/lldb/frame.rb', line 36 def function_name raise InvalidObjectError, 'Frame is not valid' unless valid? FFIBindings.lldb_frame_get_function_name(@ptr) end |
#get_module ⇒ Object
297 298 299 300 301 302 303 304 |
# File 'lib/lldb/frame.rb', line 297 def get_module raise InvalidObjectError, 'Frame is not valid' unless valid? mod_ptr = FFIBindings.lldb_frame_get_module(@ptr) return nil if mod_ptr.nil? || mod_ptr.null? Module.new(mod_ptr, target: @thread.process.target, context: context) end |
#get_registers ⇒ Object
257 258 259 260 261 262 263 264 265 |
# File 'lib/lldb/frame.rb', line 257 def get_registers raise InvalidObjectError, 'Frame is not valid' unless valid? APISupport.require_method!(:lldb_frame_get_registers, 'get_registers') list_ptr = FFIBindings.lldb_frame_get_registers(@ptr) raise LLDBError, 'Failed to get registers' if list_ptr.nil? || list_ptr.null? ValueList.new(list_ptr, parent: self, context: context) end |
#get_thread ⇒ Object
307 308 309 310 311 312 313 314 |
# File 'lib/lldb/frame.rb', line 307 def get_thread raise InvalidObjectError, 'Frame is not valid' unless valid? thread_ptr = FFIBindings.lldb_frame_get_thread(@ptr) return nil if thread_ptr.nil? || thread_ptr.null? Thread.new(thread_ptr, process: @thread.process, context: context) end |
#get_value_for_variable_path(path) ⇒ Object
198 199 200 201 202 203 204 205 |
# File 'lib/lldb/frame.rb', line 198 def get_value_for_variable_path(path) raise InvalidObjectError, 'Frame is not valid' unless valid? value_ptr = FFIBindings.lldb_frame_get_value_for_variable_path(@ptr, path) return nil if value_ptr.nil? || value_ptr.null? Value.new(value_ptr, parent: self, context: context) end |
#get_variables(arguments: true, locals: true, statics: true, in_scope_only: true) ⇒ Object
241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/lldb/frame.rb', line 241 def get_variables(arguments: true, locals: true, statics: true, in_scope_only: true) raise InvalidObjectError, 'Frame is not valid' unless valid? list_ptr = FFIBindings.lldb_frame_get_variables( @ptr, arguments ? 1 : 0, locals ? 1 : 0, statics ? 1 : 0, in_scope_only ? 1 : 0 ) raise LLDBError, 'Failed to get variables' if list_ptr.nil? || list_ptr.null? ValueList.new(list_ptr, parent: self, context: context) end |
#inlined? ⇒ Boolean
268 269 270 271 272 |
# File 'lib/lldb/frame.rb', line 268 def inlined? return false unless valid? FFIBindings.lldb_frame_is_inlined(@ptr) != 0 end |
#instruction_list ⇒ Object Also known as: instructions
282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/lldb/frame.rb', line 282 def instruction_list raise InvalidObjectError, 'Frame is not valid' unless valid? target = @thread.process.target return nil unless target list_ptr = FFIBindings.lldb_frame_get_instruction_list(@ptr, target.to_ptr) return nil if list_ptr.nil? || list_ptr.null? InstructionList.new(list_ptr, target: target, context: context) end |
#line ⇒ Object
50 51 52 53 54 |
# File 'lib/lldb/frame.rb', line 50 def line return 0 unless valid? FFIBindings.lldb_frame_get_line(@ptr) end |
#line_entry ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'lib/lldb/frame.rb', line 74 def line_entry raise InvalidObjectError, 'Frame is not valid' unless valid? line_ptr = FFIBindings.lldb_frame_get_line_entry(@ptr) return nil if line_ptr.nil? || line_ptr.null? target = @thread.process.target LineEntry.new(line_ptr, target: target, context: context) end |
#location ⇒ Object
219 220 221 |
# File 'lib/lldb/frame.rb', line 219 def location "#{file_path || '?'}:#{line}" end |
#pc ⇒ Object
132 133 134 135 136 |
# File 'lib/lldb/frame.rb', line 132 def pc return INVALID_ADDRESS unless valid? FFIBindings.lldb_frame_get_pc(@ptr) end |
#pc=(value) ⇒ Object
230 231 232 233 234 |
# File 'lib/lldb/frame.rb', line 230 def pc=(value) raise InvalidObjectError, 'Frame is not valid' unless valid? FFIBindings.lldb_frame_set_pc(@ptr, value) != 0 end |
#sp ⇒ Object
139 140 141 142 143 |
# File 'lib/lldb/frame.rb', line 139 def sp return INVALID_ADDRESS unless valid? FFIBindings.lldb_frame_get_sp(@ptr) end |
#symbol ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'lib/lldb/frame.rb', line 95 def symbol raise InvalidObjectError, 'Frame is not valid' unless valid? symbol_ptr = FFIBindings.lldb_frame_get_symbol(@ptr) return nil if symbol_ptr.nil? || symbol_ptr.null? Symbol.new(symbol_ptr, target: @thread.process.target, context: context) end |
#symbol_context(scope = SymbolContextItem::EVERYTHING) ⇒ Object
209 210 211 212 213 214 215 216 |
# File 'lib/lldb/frame.rb', line 209 def symbol_context(scope = SymbolContextItem::EVERYTHING) raise InvalidObjectError, 'Frame is not valid' unless valid? ctx_ptr = FFIBindings.lldb_frame_get_symbol_context(@ptr, scope) return nil if ctx_ptr.nil? || ctx_ptr.null? SymbolContext.new(ctx_ptr, parent: self, context: context) end |
#to_ptr ⇒ Object
317 318 319 |
# File 'lib/lldb/frame.rb', line 317 def to_ptr @ptr end |
#to_s ⇒ Object
224 225 226 |
# File 'lib/lldb/frame.rb', line 224 def to_s "#{display_function_name || function_name || '?'} at #{location}" end |
#valid? ⇒ Boolean
31 32 33 |
# File 'lib/lldb/frame.rb', line 31 def valid? !@ptr.null? && FFIBindings.lldb_frame_is_valid(@ptr) != 0 end |