Class: LLDB

Inherits:
NativeDebugger show all
Defined in:
lib/ruby-debug-ide/attach/lldb.rb

Instance Attribute Summary

Attributes inherited from NativeDebugger

#main_thread, #pid, #pipe, #process_threads

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NativeDebugger

#attach_to_process, #continue, #execute, #exit, #exited?, #find_attach_lib, #get_response, #wait_line_event

Constructor Details

#initialize(executable, pid, flags, gems_to_include, debugger_loader_path, argv) ⇒ LLDB

Returns a new instance of LLDB.


5
6
7
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 5

def initialize(executable, pid, flags, gems_to_include, debugger_loader_path, argv)
  super(executable, pid, flags, gems_to_include, debugger_loader_path, argv)
end

Class Method Details

.to_sObject


66
67
68
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 66

def to_s
  'lldb'
end

Instance Method Details

#call_start_attachObject


42
43
44
45
46
47
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 42

def call_start_attach
  super()
  execute "expr (void *) dlopen(\"#{@path_to_attach}\", 2)"
  execute 'expr (int) debase_start_attach()'
  set_break(@tbreak)
end

#check_already_under_debugObject


29
30
31
32
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 29

def check_already_under_debug
  threads = execute 'thread list'
  threads =~ /ruby-debug-ide/
end

#check_delimiter(line) ⇒ Object


53
54
55
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 53

def check_delimiter(line)
  line =~ /#{@delimiter}$/
end

#load_debuggerObject


57
58
59
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 57

def load_debugger
  execute "expr (void) #{@eval_string}"
end

49
50
51
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 49

def print_delimiter
  @pipe.puts "script print \"#{@delimiter}\""
end

#set_break(str) ⇒ Object


38
39
40
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 38

def set_break(str)
  execute "breakpoint set --shlib #{@path_to_attach} --name #{str}"
end

#set_flagsObject


9
10
11
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 9

def set_flags

end

#switch_to_thread(thread_num) ⇒ Object


34
35
36
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 34

def switch_to_thread(thread_num)
  execute "thread select #{thread_num}"
end

#to_sObject


61
62
63
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 61

def to_s
  LLDB.to_s
end

#update_threadsObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ruby-debug-ide/attach/lldb.rb', line 13

def update_threads
  @process_threads = []
  info_threads = (execute 'thread list').split("\n")
  info_threads.each do |thread_info|
    next unless thread_info =~ /[\s*]*thread\s#\d+.*/
    is_main = thread_info[0] == '*'
    thread_num = thread_info.sub(/[\s*]*thread\s#/, '').sub(/:\s.*$/, '').to_i
    thread = ProcessThread.new(thread_num, is_main, thread_info, self)
    if thread.is_main
      @main_thread = thread
    end
    @process_threads << thread
  end
  @process_threads
end