Class: Elf::SymbolTable
- Includes:
- Enumerable
- Defined in:
- lib/elf/symboltable.rb
Defined Under Namespace
Classes: UnknownSymbol
Constant Summary
Constants inherited from Section
Elf::Section::Abs, Elf::Section::Common, Elf::Section::FlagsToChars, Elf::Section::OsSpecific, Elf::Section::ProcSpecific, Elf::Section::Reserved, Elf::Section::SunW, Elf::Section::SunWIgnore, Elf::Section::Undef, Elf::Section::XIndex
Instance Attribute Summary
Attributes inherited from Section
#addr, #addralign, #entsize, #file, #index, #info, #offset, #size, #type
Instance Method Summary collapse
- #[](idx) ⇒ Object
-
#count ⇒ Object
Return the number of symbols in the section.
-
#defined_symbols ⇒ Object
Get a set with all the symbols in the table that are defined, ignoring common, absolute and undefined symbols.
-
#each(&block) ⇒ Object
Iterate over each symbols, replaces section.symbol.each.
- #load_internal ⇒ Object
Methods inherited from Section
#==, #flags, #flags_i, #flags_s, #initialize, #link, #load, #name, read, #summary
Constructor Details
This class inherits a constructor from Elf::Section
Instance Method Details
#[](idx) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/elf/symboltable.rb', line 48 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 ⇒ Object
Return the number of symbols in the section
71 72 73 |
# File 'lib/elf/symboltable.rb', line 71 def count symbols.size end |
#defined_symbols ⇒ Object
Get a set with all the symbols in the table that are defined, ignoring common, absolute and undefined symbols.
77 78 79 80 81 |
# File 'lib/elf/symboltable.rb', line 77 def defined_symbols symbols.find_all do |sym| sym.defined? end.to_set end |
#each(&block) ⇒ Object
Iterate over each symbols, replaces section.symbol.each
64 65 66 |
# File 'lib/elf/symboltable.rb', line 64 def each(&block) symbols.each(&block) end |