Class: RubyMemcheck::Frame
- Inherits:
-
Object
- Object
- RubyMemcheck::Frame
- Defined in:
- lib/ruby_memcheck/frame.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#fn ⇒ Object
readonly
Returns the value of attribute fn.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
- #in_binary? ⇒ Boolean
- #in_ruby? ⇒ Boolean
-
#initialize(configuration, frame_xml) ⇒ Frame
constructor
A new instance of Frame.
- #to_s ⇒ Object
Constructor Details
#initialize(configuration, frame_xml) ⇒ Frame
Returns a new instance of Frame.
7 8 9 10 11 12 13 14 |
# File 'lib/ruby_memcheck/frame.rb', line 7 def initialize(configuration, frame_xml) @configuration = configuration @fn = frame_xml.at_xpath("fn")&.content @obj = frame_xml.at_xpath("obj")&.content # file and line may not be available @file = frame_xml.at_xpath("file")&.content @line = frame_xml.at_xpath("line")&.content end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
5 6 7 |
# File 'lib/ruby_memcheck/frame.rb', line 5 def configuration @configuration end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/ruby_memcheck/frame.rb', line 5 def file @file end |
#fn ⇒ Object (readonly)
Returns the value of attribute fn.
5 6 7 |
# File 'lib/ruby_memcheck/frame.rb', line 5 def fn @fn end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
5 6 7 |
# File 'lib/ruby_memcheck/frame.rb', line 5 def line @line end |
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
5 6 7 |
# File 'lib/ruby_memcheck/frame.rb', line 5 def obj @obj end |
Instance Method Details
#in_binary? ⇒ Boolean
22 23 24 25 26 27 28 |
# File 'lib/ruby_memcheck/frame.rb', line 22 def in_binary? if obj File.basename(obj, ".*") == configuration.binary_name else false end end |
#in_ruby? ⇒ Boolean
16 17 18 19 20 |
# File 'lib/ruby_memcheck/frame.rb', line 16 def in_ruby? obj == configuration.ruby || # Hack to fix Ruby built with --enabled-shared File.basename(obj) == "libruby.so.#{RUBY_VERSION}" end |
#to_s ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/ruby_memcheck/frame.rb', line 30 def to_s if file "#{fn} (#{file}:#{line})" elsif fn "#{fn} (at #{obj})" else "<unknown stack frame>" end end |