class RubyMemcheck::ValgrindError

Constants

SUPPRESSION_NOT_CONFIGURED_ERROR_MSG

Attributes

kind[R]
msg[R]
stack[R]
suppression[R]

Public Class Methods

new(configuration, error) click to toggle source
# File lib/ruby_memcheck/valgrind_error.rb, line 10
def initialize(configuration, error)
  @kind = error.at_xpath("kind").content
  @msg =
    if kind_leak?
      error.at_xpath("xwhat/text").content
    else
      error.at_xpath("what").content
    end
  @stack = Stack.new(configuration, error.at_xpath("stack"))
  @configuration = configuration

  suppression_node = error.at_xpath("suppression")
  if configuration.valgrind_generate_suppressions?
    @suppression = Suppression.new(configuration, suppression_node)
  elsif suppression_node
    raise SUPPRESSION_NOT_CONFIGURED_ERROR_MSG
  end
end

Public Instance Methods

skip?() click to toggle source
# File lib/ruby_memcheck/valgrind_error.rb, line 29
def skip?
  should_filter? && stack.skip?
end
to_s() click to toggle source
# File lib/ruby_memcheck/valgrind_error.rb, line 33
def to_s
  str = StringIO.new
  str << "#{msg}\n"
  stack.frames.each do |frame|
    str << if frame.in_binary?
      " *#{frame}\n"
    else
      "  #{frame}\n"
    end
  end
  str << suppression.to_s if suppression
  str.string
end

Private Instance Methods

kind_leak?() click to toggle source
# File lib/ruby_memcheck/valgrind_error.rb, line 53
def kind_leak?
  kind.start_with?("Leak_")
end
should_filter?() click to toggle source
# File lib/ruby_memcheck/valgrind_error.rb, line 49
def should_filter?
  kind_leak?
end