Class: LLDB::CommandInterpreter
- Inherits:
-
Object
- Object
- LLDB::CommandInterpreter
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/command_interpreter.rb
Instance Attribute Summary collapse
- #debugger ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #alias_exists?(alias_name) ⇒ Boolean
- #command_exists?(command) ⇒ Boolean
- #handle_command(command, add_to_history: true) ⇒ Object
-
#initialize(ptr, debugger:, context: debugger.context) ⇒ CommandInterpreter
constructor
A new instance of CommandInterpreter.
- #to_ptr ⇒ Object
- #valid? ⇒ Boolean
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(ptr, debugger:, context: debugger.context) ⇒ CommandInterpreter
Returns a new instance of CommandInterpreter.
15 16 17 18 19 20 21 22 |
# File 'lib/lldb/command_interpreter.rb', line 15 def initialize(ptr, debugger:, context: debugger.context) @debugger = debugger initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_command_interpreter_destroy(released) }, context: context ) end |
Instance Attribute Details
#debugger ⇒ Object (readonly)
10 11 12 |
# File 'lib/lldb/command_interpreter.rb', line 10 def debugger @debugger end |
Class Method Details
.release(ptr) ⇒ Object
26 27 28 |
# File 'lib/lldb/command_interpreter.rb', line 26 def self.release(ptr) ->(_id) { FFIBindings.lldb_command_interpreter_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#alias_exists?(alias_name) ⇒ Boolean
56 57 58 59 60 |
# File 'lib/lldb/command_interpreter.rb', line 56 def alias_exists?(alias_name) return false unless valid? FFIBindings.lldb_command_interpreter_alias_exists(@ptr, alias_name) != 0 end |
#command_exists?(command) ⇒ Boolean
48 49 50 51 52 |
# File 'lib/lldb/command_interpreter.rb', line 48 def command_exists?(command) return false unless valid? FFIBindings.lldb_command_interpreter_command_exists(@ptr, command) != 0 end |
#handle_command(command, add_to_history: true) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/lldb/command_interpreter.rb', line 38 def handle_command(command, add_to_history: true) raise InvalidObjectError, 'CommandInterpreter is not valid' unless valid? result = CommandReturnObject.create(context: context) FFIBindings.lldb_command_interpreter_handle_command(@ptr, command, result.to_ptr, add_to_history ? 1 : 0) result end |
#to_ptr ⇒ Object
63 64 65 |
# File 'lib/lldb/command_interpreter.rb', line 63 def to_ptr @ptr end |
#valid? ⇒ Boolean
31 32 33 |
# File 'lib/lldb/command_interpreter.rb', line 31 def valid? !@ptr.null? && FFIBindings.lldb_command_interpreter_is_valid(@ptr) != 0 end |