class Elf::SymbolTable
Public Instance Methods
[](idx)
click to toggle source
# File lib/elf/symboltable.rb, line 47 def [](idx) load unless @symbols if idx.is_a?(Numeric) raise UnknownSymbol.new(idx, self) unless @symbols[idx] != nil return @symbols[idx] elsif idx.respond_to?("to_s") idx = idx.to_s raise UnknownSymbol.new(idx, self) unless @symbol_names.has_key?(idx) return @symbols[@symbol_names[idx]] else raise TypeError.new("wrong argument type #{sect_idx_or_name.class} (expected String or Integer)") end end
count()
click to toggle source
Return the number of symbols in the section
# File lib/elf/symboltable.rb, line 70 def count symbols.size end
defined_symbols()
click to toggle source
Get a set with all the symbols in the table that are defined, ignoring common, absolute and undefined symbols.
# File lib/elf/symboltable.rb, line 76 def defined_symbols symbols.find_all do |sym| sym.defined? end.to_set end
each(&block)
click to toggle source
Iterate over each symbols, replaces section.symbol.each
# File lib/elf/symboltable.rb, line 63 def each(&block) symbols.each(&block) end
load_internal()
click to toggle source
# File lib/elf/symboltable.rb, line 27 def load_internal @symbols = [] @symbol_names = {} for i in 1..(@numentries) sym = Symbol.new(@file, self, i-1) @symbols << sym @symbol_names[sym.name] = sym.idx end return nil end
Private Instance Methods
symbols()
click to toggle source
# File lib/elf/symboltable.rb, line 83 def symbols load unless @symbols @symbols end