Sha256: 6d9796aa7a6d6f4c4c09802a2b6dd6bde6396edfac0beb962f42091f57cea91e

Contents?: true

Size: 1.09 KB

Versions: 37

Compression:

Stored size: 1.09 KB

Contents

require 'ruby-debug-ide/attach/native_debugger'

class ProcessThread

  attr_reader :thread_num, :is_main, :thread_info, :last_bt

  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

  def switch
    @native_debugger.switch_to_thread(thread_num)
  end

  def finish
    @native_debugger.execute 'finish'
  end

  def get_bt
    @last_bt = @native_debugger.execute 'bt'
  end

  def any_caller_match(bt, pattern)
    bt =~ /#{pattern}/
  end

  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

  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

  def need_finish_frame
    bt = get_bt
    is_inside_malloc(bt) || is_inside_gc(bt)
  end

end

Version data entries

37 entries across 29 versions & 5 rubygems

Version Path
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/attach/process_thread.rb
ruby-debug-ide22-0.7.5 lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/attach/process_thread.rb
ruby-debug-ide-0.7.3 lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/attach/process_thread.rb
ruby-debug-ide-0.7.2 lib/ruby-debug-ide/attach/process_thread.rb
ruby-debug-ide-0.7.1.beta3 lib/ruby-debug-ide/attach/process_thread.rb
ruby-debug-ide-0.7.1.beta2 lib/ruby-debug-ide/attach/process_thread.rb