module Hoe::Debugging

Whee, stuff to help when your codes are b0rked. Tasks provided:

Constants

ERROR_EXITCODE

The exit code of valgrind when it detects an error.

Attributes

gdb_options[RW]

Optional: Used to add flags to GDB. [default: []]

valgrind_options[RW]

Optional: Used to add flags to valgrind. [default: %w(--num-callers=50 --error-limit=no --partial-loads-ok=yes --undef-value-errors=no)]

Public Instance Methods

hoe_debugging_check_for_suppression_file(options) click to toggle source
# File lib/hoe/debugging.rb, line 68
def hoe_debugging_check_for_suppression_file options
  suppression_files = hoe_debugging_valgrind_helper.matching_suppression_files
  suppression_files.each do |suppression_file|
    puts "NOTICE: using valgrind suppressions in #{suppression_file.inspect}"
    options << "--suppressions=#{suppression_file}"
  end
end
hoe_debugging_command() click to toggle source
# File lib/hoe/debugging.rb, line 60
def hoe_debugging_command
  "#{hoe_debugging_ruby} #{hoe_debugging_make_test_cmd}"
end
hoe_debugging_make_test_cmd() click to toggle source
# File lib/hoe/debugging.rb, line 49
def hoe_debugging_make_test_cmd
  cmd = []
  if File.directory? "spec"
    cmd << "-S rspec"
    cmd << (ENV['FILTER'] || ENV['TESTOPTS'])
  else
    cmd << make_test_cmd
  end
  cmd.join(' ')
end
hoe_debugging_ruby() click to toggle source
# File lib/hoe/debugging.rb, line 44
def hoe_debugging_ruby
  # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/151376
  @ruby ||= File.join(RbConfig::CONFIG["bindir"], (RbConfig::CONFIG["RUBY_INSTALL_NAME"] + RbConfig::CONFIG["EXEEXT"]))
end
hoe_debugging_run_valgrind(command, cmdline_options=[]) click to toggle source
# File lib/hoe/debugging.rb, line 64
def hoe_debugging_run_valgrind command, cmdline_options=[]
  sh "#{hoe_debugging_valgrind_helper.valgrind} #{cmdline_options.join(' ')} #{command}"
end
hoe_debugging_valgrind_helper() click to toggle source
# File lib/hoe/debugging.rb, line 76
def hoe_debugging_valgrind_helper
  @valgrind_helper ||= ValgrindHelper.new name
end