Class: ProcessThread
- Inherits:
-
Object
- Object
- ProcessThread
- Defined in:
- lib/ruby-debug-ide/attach/process_thread.rb
Instance Attribute Summary collapse
-
#is_main ⇒ Object
readonly
Returns the value of attribute is_main.
-
#last_bt ⇒ Object
readonly
Returns the value of attribute last_bt.
-
#thread_info ⇒ Object
readonly
Returns the value of attribute thread_info.
-
#thread_num ⇒ Object
readonly
Returns the value of attribute thread_num.
Instance Method Summary collapse
- #any_caller_match(bt, pattern) ⇒ Object
- #finish ⇒ Object
- #get_bt ⇒ Object
-
#initialize(thread_num, is_main, thread_info, native_debugger) ⇒ ProcessThread
constructor
A new instance of ProcessThread.
- #is_inside_gc(bt = get_bt) ⇒ Object
- #is_inside_malloc(bt = get_bt) ⇒ Object
- #need_finish_frame ⇒ Object
- #switch ⇒ Object
Constructor Details
#initialize(thread_num, is_main, thread_info, native_debugger) ⇒ ProcessThread
Returns a new instance of ProcessThread.
7 8 9 10 11 12 13 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 7 def initialize(thread_num, is_main, thread_info, native_debugger) @thread_num = thread_num @is_main = is_main @native_debugger = native_debugger @thread_info = thread_info @last_bt = nil end |
Instance Attribute Details
#is_main ⇒ Object (readonly)
Returns the value of attribute is_main.
5 6 7 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 5 def is_main @is_main end |
#last_bt ⇒ Object (readonly)
Returns the value of attribute last_bt.
5 6 7 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 5 def last_bt @last_bt end |
#thread_info ⇒ Object (readonly)
Returns the value of attribute thread_info.
5 6 7 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 5 def thread_info @thread_info end |
#thread_num ⇒ Object (readonly)
Returns the value of attribute thread_num.
5 6 7 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 5 def thread_num @thread_num end |
Instance Method Details
#any_caller_match(bt, pattern) ⇒ Object
27 28 29 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 27 def any_caller_match(bt, pattern) bt =~ /#{pattern}/ end |
#finish ⇒ Object
19 20 21 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 19 def finish @native_debugger.execute 'finish' end |
#get_bt ⇒ Object
23 24 25 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 23 def get_bt @last_bt = @native_debugger.execute 'bt' end |
#is_inside_gc(bt = get_bt) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 40 def is_inside_gc(bt = get_bt) if any_caller_match(bt, '(gc\.c)') $stderr.puts "process #{@native_debugger.pid} is currently in garbage collection phase." true else false end end |
#is_inside_malloc(bt = get_bt) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 31 def is_inside_malloc(bt = get_bt) if any_caller_match(bt, '(malloc)') $stderr.puts "process #{@native_debugger.pid} is currently inside malloc." true else false end end |
#need_finish_frame ⇒ Object
49 50 51 52 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 49 def need_finish_frame bt = get_bt is_inside_malloc(bt) || is_inside_gc(bt) end |
#switch ⇒ Object
15 16 17 |
# File 'lib/ruby-debug-ide/attach/process_thread.rb', line 15 def switch @native_debugger.switch_to_thread(thread_num) end |