Class: LLDB::LaunchInfo
- Inherits:
-
Object
- Object
- LLDB::LaunchInfo
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/launch_info.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_close_file_action(fd) ⇒ Object
- #add_duplicate_file_action(fd, dup_fd) ⇒ Object
- #add_open_file_action(fd, path, read: false, write: false) ⇒ Object
- #add_suppress_file_action(fd, read: false, write: false) ⇒ Object
- #arguments ⇒ Object
- #arguments=(args, append: false) ⇒ Object
- #environment_entries ⇒ Object
- #executable_file ⇒ Object
- #executable_file=(file, add_as_first_arg: false) ⇒ Object
-
#initialize(args = nil, context: nil) ⇒ LaunchInfo
constructor
A new instance of LaunchInfo.
- #launch_flags ⇒ Object
- #launch_flags=(flags) ⇒ Object
- #listener ⇒ Object
- #listener=(value) ⇒ Object
- #process_plugin_name ⇒ Object
- #process_plugin_name=(value) ⇒ Object
- #set_environment(env, append: true) ⇒ Object
- #shell ⇒ Object
- #shell=(value) ⇒ Object
- #to_ptr ⇒ Object
- #valid? ⇒ Boolean
- #working_directory ⇒ Object
- #working_directory=(dir) ⇒ Object
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(args = nil, context: nil) ⇒ LaunchInfo
Returns a new instance of LaunchInfo.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/lldb/launch_info.rb', line 29 def initialize(args = nil, context: nil) @arguments = if args && !args.empty? NativeStringArray.new(args) end ptr = FFIBindings.lldb_launch_info_create(@arguments&.to_ptr) initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_launch_info_destroy(released) }, context: context ) end |
Class Method Details
.release(ptr) ⇒ Object
44 45 46 |
# File 'lib/lldb/launch_info.rb', line 44 def self.release(ptr) ->(_id) { FFIBindings.lldb_launch_info_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#add_close_file_action(fd) ⇒ Object
166 167 168 |
# File 'lib/lldb/launch_info.rb', line 166 def add_close_file_action(fd) FFIBindings.lldb_launch_info_add_close_file_action(@ptr, fd) != 0 end |
#add_duplicate_file_action(fd, dup_fd) ⇒ Object
173 174 175 |
# File 'lib/lldb/launch_info.rb', line 173 def add_duplicate_file_action(fd, dup_fd) FFIBindings.lldb_launch_info_add_duplicate_file_action(@ptr, fd, dup_fd) != 0 end |
#add_open_file_action(fd, path, read: false, write: false) ⇒ Object
182 183 184 185 |
# File 'lib/lldb/launch_info.rb', line 182 def add_open_file_action(fd, path, read: false, write: false) NativeStringArray.validate!(path) FFIBindings.lldb_launch_info_add_open_file_action(@ptr, fd, path, read ? 1 : 0, write ? 1 : 0) != 0 end |
#add_suppress_file_action(fd, read: false, write: false) ⇒ Object
191 192 193 |
# File 'lib/lldb/launch_info.rb', line 191 def add_suppress_file_action(fd, read: false, write: false) FFIBindings.lldb_launch_info_add_suppress_file_action(@ptr, fd, read ? 1 : 0, write ? 1 : 0) != 0 end |
#arguments ⇒ Object
94 95 96 97 |
# File 'lib/lldb/launch_info.rb', line 94 def arguments count = FFIBindings.lldb_launch_info_get_num_arguments(@ptr) (0...count).map { |index| FFIBindings.lldb_launch_info_get_argument_at_index(@ptr, index).to_s } end |
#arguments=(args, append: false) ⇒ Object
86 87 88 89 90 91 |
# File 'lib/lldb/launch_info.rb', line 86 def arguments=(args, append: false) raise ArgumentError, 'arguments must be an Array' unless args.is_a?(Array) @arguments = NativeStringArray.new(args) FFIBindings.lldb_launch_info_set_arguments(@ptr, @arguments.to_ptr, append ? 1 : 0) end |
#environment_entries ⇒ Object
100 101 102 103 104 105 |
# File 'lib/lldb/launch_info.rb', line 100 def environment_entries count = FFIBindings.lldb_launch_info_get_num_environment_entries(@ptr) (0...count).map do |index| FFIBindings.lldb_launch_info_get_environment_entry_at_index(@ptr, index).to_s end end |
#executable_file ⇒ Object
108 109 110 111 112 113 |
# File 'lib/lldb/launch_info.rb', line 108 def executable_file file_ptr = FFIBindings.lldb_launch_info_get_executable_file(@ptr) return nil if file_ptr.nil? || file_ptr.null? FileSpec.from_ptr(file_ptr, context: context) end |
#executable_file=(file, add_as_first_arg: false) ⇒ Object
118 119 120 121 122 |
# File 'lib/lldb/launch_info.rb', line 118 def executable_file=(file, add_as_first_arg: false) raise ArgumentError, 'file must be a FileSpec' unless file.is_a?(FileSpec) FFIBindings.lldb_launch_info_set_executable_file(@ptr, file.to_ptr, add_as_first_arg ? 1 : 0) end |
#launch_flags ⇒ Object
196 197 198 |
# File 'lib/lldb/launch_info.rb', line 196 def launch_flags FFIBindings.lldb_launch_info_get_launch_flags(@ptr) end |
#launch_flags=(flags) ⇒ Object
202 203 204 |
# File 'lib/lldb/launch_info.rb', line 202 def launch_flags=(flags) FFIBindings.lldb_launch_info_set_launch_flags(@ptr, flags) end |
#listener ⇒ Object
125 126 127 128 129 130 |
# File 'lib/lldb/launch_info.rb', line 125 def listener listener_ptr = FFIBindings.lldb_launch_info_get_listener(@ptr) return nil if listener_ptr.nil? || listener_ptr.null? Listener.from_ptr(listener_ptr, context: context) end |
#listener=(value) ⇒ Object
134 135 136 137 138 |
# File 'lib/lldb/launch_info.rb', line 134 def listener=(value) raise ArgumentError, 'listener must be a Listener' unless value.is_a?(Listener) FFIBindings.lldb_launch_info_set_listener(@ptr, value.to_ptr) end |
#process_plugin_name ⇒ Object
141 142 143 |
# File 'lib/lldb/launch_info.rb', line 141 def process_plugin_name FFIBindings.lldb_launch_info_get_process_plugin_name(@ptr) end |
#process_plugin_name=(value) ⇒ Object
147 148 149 150 |
# File 'lib/lldb/launch_info.rb', line 147 def process_plugin_name=(value) NativeStringArray.validate!(value) FFIBindings.lldb_launch_info_set_process_plugin_name(@ptr, value) end |
#set_environment(env, append: true) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/lldb/launch_info.rb', line 68 def set_environment(env, append: true) return if env.nil? raise ArgumentError, 'environment must be a Hash' unless env.is_a?(Hash) entries = env.map do |key, value| key = NativeStringArray.validate!(key) value = NativeStringArray.validate!(value) raise ArgumentError, 'environment keys must not contain =' if key.include?('=') "#{key}=#{value}" end strings = NativeStringArray.new(entries) FFIBindings.lldb_launch_info_set_environment_entries(@ptr, strings.to_ptr, append ? 1 : 0) end |
#shell ⇒ Object
153 154 155 |
# File 'lib/lldb/launch_info.rb', line 153 def shell FFIBindings.lldb_launch_info_get_shell(@ptr) end |
#shell=(value) ⇒ Object
159 160 161 162 |
# File 'lib/lldb/launch_info.rb', line 159 def shell=(value) NativeStringArray.validate!(value) FFIBindings.lldb_launch_info_set_shell(@ptr, value) end |
#to_ptr ⇒ Object
207 208 209 |
# File 'lib/lldb/launch_info.rb', line 207 def to_ptr @ptr end |
#valid? ⇒ Boolean
49 50 51 |
# File 'lib/lldb/launch_info.rb', line 49 def valid? !@ptr.null? end |
#working_directory ⇒ Object
61 62 63 |
# File 'lib/lldb/launch_info.rb', line 61 def working_directory FFIBindings.lldb_launch_info_get_working_directory(@ptr) end |
#working_directory=(dir) ⇒ Object
55 56 57 58 |
# File 'lib/lldb/launch_info.rb', line 55 def working_directory=(dir) NativeStringArray.validate!(dir) FFIBindings.lldb_launch_info_set_working_directory(@ptr, dir) end |