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.
-
#loaded_binaries ⇒ Object
readonly
Returns the value of attribute loaded_binaries.
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
- #binary_init_func? ⇒ Boolean
- #in_binary? ⇒ Boolean
- #in_ruby? ⇒ Boolean
-
#initialize(configuration, loaded_binaries, frame_xml) ⇒ Frame
constructor
A new instance of Frame.
- #to_s ⇒ Object
Constructor Details
#initialize(configuration, loaded_binaries, frame_xml) ⇒ Frame
Returns a new instance of Frame.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ruby_memcheck/frame.rb', line 7 def initialize(configuration, loaded_binaries, frame_xml) @configuration = configuration @loaded_binaries = loaded_binaries @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 |
#loaded_binaries ⇒ Object (readonly)
Returns the value of attribute loaded_binaries.
5 6 7 |
# File 'lib/ruby_memcheck/frame.rb', line 5 def loaded_binaries @loaded_binaries 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
#binary_init_func? ⇒ Boolean
32 33 34 35 36 37 |
# File 'lib/ruby_memcheck/frame.rb', line 32 def binary_init_func? return false unless in_binary? binary_name = File.basename(obj, ".*") fn == "Init_#{binary_name}" end |
#in_binary? ⇒ Boolean
26 27 28 29 30 |
# File 'lib/ruby_memcheck/frame.rb', line 26 def in_binary? return false unless obj loaded_binaries.include?(obj) end |
#in_ruby? ⇒ Boolean
18 19 20 21 22 23 24 |
# File 'lib/ruby_memcheck/frame.rb', line 18 def in_ruby? return false unless obj obj == configuration.ruby || # Hack to fix Ruby built with --enabled-shared File.basename(obj) == "libruby.so.#{RUBY_VERSION}" end |
#to_s ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/ruby_memcheck/frame.rb', line 39 def to_s if file "#{fn} (#{file}:#{line})" elsif fn "#{fn} (at #{obj})" else "<unknown stack frame>" end end |