Class: RubyMemcheck::ValgrindError
- Inherits:
-
Object
- Object
- RubyMemcheck::ValgrindError
- Defined in:
- lib/ruby_memcheck/valgrind_error.rb
Constant Summary collapse
- SUPPRESSION_NOT_CONFIGURED_ERROR_MSG =
"Please enable suppressions by configuring with valgrind_generate_suppressions set to true"
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
-
#suppression ⇒ Object
readonly
Returns the value of attribute suppression.
Instance Method Summary collapse
-
#initialize(configuration, loaded_binaries, error) ⇒ ValgrindError
constructor
A new instance of ValgrindError.
- #skip? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(configuration, loaded_binaries, error) ⇒ ValgrindError
Returns a new instance of ValgrindError.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ruby_memcheck/valgrind_error.rb', line 10 def initialize(configuration, loaded_binaries, 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, loaded_binaries, 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 |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
8 9 10 |
# File 'lib/ruby_memcheck/valgrind_error.rb', line 8 def kind @kind end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
8 9 10 |
# File 'lib/ruby_memcheck/valgrind_error.rb', line 8 def msg @msg end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
8 9 10 |
# File 'lib/ruby_memcheck/valgrind_error.rb', line 8 def stack @stack end |
#suppression ⇒ Object (readonly)
Returns the value of attribute suppression.
8 9 10 |
# File 'lib/ruby_memcheck/valgrind_error.rb', line 8 def suppression @suppression end |
Instance Method Details
#skip? ⇒ Boolean
29 30 31 |
# File 'lib/ruby_memcheck/valgrind_error.rb', line 29 def skip? should_filter? && stack.skip? end |
#to_s ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# 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 |