Class: RunLoop::LLDB

Inherits:
Object
  • Object
show all
Defined in:
lib/run_loop/lldb.rb

Overview

A class for interacting with the lldb command-line tool

Class Method Summary collapse

Class Method Details

.kill_lldb_processesObject

Attempts to gracefully kill all running lldb processes.


34
35
36
37
38
# File 'lib/run_loop/lldb.rb', line 34

def self.kill_lldb_processes
  self.lldb_pids.each do |pid|
    self.kill_with_signal(pid, 'KILL')
  end
end

.lldb_pidsArray<Integer>

Returns a list of lldb pids.


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/run_loop/lldb.rb', line 8

def self.lldb_pids
  ps_output = `#{LLDB_FIND_PIDS_CMD}`.strip
  lines = ps_output.lines("\n").map { |line| line.strip }
  lldb_processes = lines.select { |line| self.is_lldb_process?(line) }
  lldb_processes.map do |ps_description|
    tokens = ps_description.strip.split(' ').map { |token| token.strip }
    pid = tokens.fetch(0, nil)
    if pid.nil?
      nil
    else
      pid.to_i
    end
  end.compact.sort
end