Class: Cymbol::Resolv

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/ruby-cymbol.rb

Instance Method Summary collapse

Constructor Details

#initializeResolv

Returns a new instance of Resolv.



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ruby-cymbol.rb', line 75

def initialize
  shared_name = Cymbol.ruby_shared_name

  # Use debug info of libruby if exists
  debug_info_name = "/usr/lib/debug/" + shared_name

  if File.exist?(debug_info_name)
    shared_name = debug_info_name
  end

  @objdump = Cymbol::Objdump.new( shared_name )
end

Instance Method Details

#resolv(symbol_name) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ruby-cymbol.rb', line 88

def resolv( symbol_name )
  match_symbols = @objdump.symbols.select{|s| s.name == symbol_name }

  first_symbol = match_symbols.first

  unless first_symbol
    raise SymbolNotFound.new(symbol_name)
  end

  match_symbols.first.offset
end