#include <SymLite-elf.h>
Public Member Functions | |
| virtual Symbol_t | getSymbolByName (std::string symname) |
| virtual Symbol_t | getContainingSymbol (Dyninst::Offset offset) |
| virtual std::string | getInterpreterName () |
| virtual unsigned | numSegments () |
| virtual bool | getSegment (unsigned num, SymSegment ®) |
| virtual Dyninst::Offset | getSymbolOffset (const Symbol_t &sym) |
| virtual Dyninst::Offset | getSymbolTOC (const Symbol_t &sym) |
| virtual std::string | getSymbolName (const Symbol_t &sym) |
| virtual std::string | getDemangledName (const Symbol_t &sym) |
| virtual bool | isValidSymbol (const Symbol_t &sym) |
| virtual unsigned | getAddressWidth () |
| virtual unsigned long | getSymbolSize (const Symbol_t &sym) |
| virtual Section_t | getSectionByName (std::string name) |
| virtual Section_t | getSectionByAddress (Dyninst::Address addr) |
| virtual Dyninst::Address | getSectionAddress (Section_t sec) |
| virtual std::string | getSectionName (Section_t sec) |
| virtual bool | isValidSection (Section_t sec) |
| virtual Dyninst::Offset | imageOffset () |
| virtual Dyninst::Offset | dataOffset () |
| void * | getElfHandle () |
| int | getFD () |
Data Fields | |
| int | ref_count |
| bool | construction_error |
Private Member Functions | |
| SymElf (std::string file_) | |
| SymElf (const char *buffer_, unsigned long size_) | |
| virtual | ~SymElf () |
| void | createSymCache () |
| Symbol_t | lookupCachedSymbol (Dyninst::Offset offset) |
| void | init () |
| unsigned long | getSymOffset (const Elf_X_Sym &symbol, unsigned idx) |
| unsigned long | getSymTOC (const Elf_X_Sym &symbol, unsigned idx) |
Private Attributes | |
| Elf_X * | elf |
| int | fd |
| bool | need_odp |
| Elf_X_Shdr * | odp_section |
| std::string | file |
| const char * | buffer |
| unsigned long | buffer_size |
| SymCacheEntry * | cache |
| unsigned | cache_size |
| Elf_X_Shdr * | sym_sections |
| unsigned | sym_sections_size |
Friends | |
| class | SymElfFactory |
Definition at line 45 of file SymLite-elf.h.
| SymElf::SymElf | ( | std::string | file_ | ) | [private] |
Definition at line 42 of file SymLite-elf.C.
References construction_error, elf, fd, init(), Dyninst::Elf_X::isValid(), and Dyninst::Elf_X::newElf_X().
| SymElf::SymElf | ( | const char * | buffer_, | |
| unsigned long | size_ | |||
| ) | [private] |
Definition at line 71 of file SymLite-elf.C.
References buffer_size, construction_error, elf, init(), Dyninst::Elf_X::isValid(), and Dyninst::Elf_X::newElf_X().
| SymElf::~SymElf | ( | ) | [private, virtual] |
Definition at line 93 of file SymLite-elf.C.
References cache, cache_size, elf, Dyninst::Elf_X::end(), fd, Dyninst::Elf_X::isValid(), sym_sections, and sym_sections_size.
| void SymElf::createSymCache | ( | ) | [private] |
Definition at line 406 of file SymLite-elf.C.
References cache, cache_size, Dyninst::Elf_X_Sym::count(), Dyninst::SymCacheEntry::demangled_name, Dyninst::Elf_X::e_shnum(), elf, FOR_EACH_SYMBOL, Dyninst::Elf_X_Shdr::get_data(), Dyninst::Elf_X::get_shdr(), Dyninst::Elf_X_Data::get_sym(), getSymOffset(), Dyninst::Elf_X_Shdr::sh_type(), sym_sections, sym_sections_size, Dyninst::SymCacheEntry::symaddress, symcache_cmp(), and Dyninst::SymCacheEntry::symloc.
Referenced by getContainingSymbol().
| Dyninst::Offset SymElf::dataOffset | ( | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 591 of file SymLite-elf.C.
| unsigned SymElf::getAddressWidth | ( | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 293 of file SymLite-elf.C.
References elf, and Dyninst::Elf_X::wordSize().
| Symbol_t SymElf::getContainingSymbol | ( | Dyninst::Offset | offset | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 197 of file SymLite-elf.C.
References cache, createSymCache(), Dyninst::Elf_X::e_shnum(), elf, FOR_EACH_SYMBOL, GET_INVALID_SYMBOL, Dyninst::Elf_X::get_shdr(), getSymOffset(), lookupCachedSymbol(), MAKE_SYMBOL, and Dyninst::Elf_X_Shdr::sh_type().
| std::string SymElf::getDemangledName | ( | const Symbol_t & | sym | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 333 of file SymLite-elf.C.
References cache, Dyninst::SymCacheEntry::demangled_name, Dyninst::Symbol_t::i2, INVALID_SYM_CODE, P_cplus_demangle(), UNSET_INDEX_CODE, and Dyninst::Symbol_t::v1.
| void * SymElf::getElfHandle | ( | ) | [virtual] |
Reimplemented from Dyninst::SymReader.
Definition at line 596 of file SymLite-elf.C.
References elf.
| int SymElf::getFD | ( | ) | [virtual] |
| std::string SymElf::getInterpreterName | ( | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 236 of file SymLite-elf.C.
References buffer, Dyninst::Elf_X::e_phnum(), Dyninst::Elf_X::e_rawfile(), elf, fd, Dyninst::Elf_X::get_phdr(), Dyninst::Elf_X_Phdr::p_offset(), and Dyninst::Elf_X_Phdr::p_type().
| Dyninst::Address SymElf::getSectionAddress | ( | Section_t | sec | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 560 of file SymLite-elf.C.
References elf, Dyninst::Elf_X::get_shdr(), Dyninst::Section_t::i1, isValidSection(), and Dyninst::Elf_X_Shdr::sh_addr().
| Section_t SymElf::getSectionByAddress | ( | Dyninst::Address | addr | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 542 of file SymLite-elf.C.
References Dyninst::Elf_X::e_shnum(), elf, Dyninst::Elf_X::get_shdr(), Dyninst::Section_t::i1, Dyninst::Elf_X_Shdr::sh_addr(), and Dyninst::Elf_X_Shdr::sh_size().
| Section_t SymElf::getSectionByName | ( | std::string | name | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 520 of file SymLite-elf.C.
References Dyninst::Elf_X_Data::d_buf(), Dyninst::Elf_X::e_shnum(), Dyninst::Elf_X::e_shstrndx(), elf, Dyninst::Elf_X_Shdr::get_data(), Dyninst::Elf_X::get_shdr(), Dyninst::Section_t::i1, and Dyninst::Elf_X_Shdr::sh_name().
| std::string SymElf::getSectionName | ( | Section_t | sec | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 568 of file SymLite-elf.C.
References Dyninst::Elf_X_Data::d_buf(), Dyninst::Elf_X::e_shstrndx(), elf, Dyninst::Elf_X_Shdr::get_data(), Dyninst::Elf_X::get_shdr(), Dyninst::Section_t::i1, isValidSection(), and Dyninst::Elf_X_Shdr::sh_name().
| bool SymElf::getSegment | ( | unsigned | num, | |
| SymSegment & | reg | |||
| ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 278 of file SymLite-elf.C.
References Dyninst::Elf_X::e_phnum(), elf, Dyninst::SymSegment::file_offset, Dyninst::SymSegment::file_size, Dyninst::Elf_X::get_phdr(), Dyninst::SymSegment::mem_addr, Dyninst::SymSegment::mem_size, Dyninst::Elf_X_Phdr::p_filesz(), Dyninst::Elf_X_Phdr::p_flags(), Dyninst::Elf_X_Phdr::p_memsz(), Dyninst::Elf_X_Phdr::p_offset(), Dyninst::Elf_X_Phdr::p_type(), Dyninst::Elf_X_Phdr::p_vaddr(), Dyninst::SymSegment::perms, and Dyninst::SymSegment::type.
| Symbol_t SymElf::getSymbolByName | ( | std::string | symname | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 170 of file SymLite-elf.C.
References Dyninst::Elf_X::e_shnum(), elf, FOR_EACH_SYMBOL, GET_INVALID_SYMBOL, Dyninst::Elf_X::get_shdr(), MAKE_SYMBOL, and Dyninst::Elf_X_Shdr::sh_type().
| std::string SymElf::getSymbolName | ( | const Symbol_t & | sym | ) | [virtual] |
| Dyninst::Offset SymElf::getSymbolOffset | ( | const Symbol_t & | sym | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 306 of file SymLite-elf.C.
References cache, GET_SYMBOL, getSymOffset(), Dyninst::Symbol_t::i2, INVALID_SYM_CODE, Dyninst::SymCacheEntry::symaddress, and UNSET_INDEX_CODE.
| unsigned long SymElf::getSymbolSize | ( | const Symbol_t & | sym | ) | [virtual] |
| Dyninst::Offset SymElf::getSymbolTOC | ( | const Symbol_t & | sym | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 319 of file SymLite-elf.C.
References GET_SYMBOL, and getSymTOC().
| unsigned long SymElf::getSymOffset | ( | const Elf_X_Sym & | symbol, | |
| unsigned | idx | |||
| ) | [private] |
Definition at line 372 of file SymLite-elf.C.
References Dyninst::Elf_X_Data::d_buf(), Dyninst::Elf_X_Shdr::get_data(), need_odp, odp_section, Dyninst::Elf_X_Shdr::sh_addr(), Dyninst::Elf_X_Shdr::sh_size(), Dyninst::Elf_X_Sym::ST_TYPE(), and Dyninst::Elf_X_Sym::st_value().
Referenced by createSymCache(), getContainingSymbol(), and getSymbolOffset().
| unsigned long SymElf::getSymTOC | ( | const Elf_X_Sym & | symbol, | |
| unsigned | idx | |||
| ) | [private] |
Definition at line 388 of file SymLite-elf.C.
References Dyninst::Elf_X_Data::d_buf(), Dyninst::Elf_X_Shdr::get_data(), need_odp, odp_section, Dyninst::Elf_X_Shdr::sh_addr(), Dyninst::Elf_X_Shdr::sh_size(), Dyninst::Elf_X_Sym::ST_TYPE(), and Dyninst::Elf_X_Sym::st_value().
Referenced by getSymbolTOC().
| Dyninst::Offset SymElf::imageOffset | ( | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 586 of file SymLite-elf.C.
| void SymElf::init | ( | ) | [private] |
Definition at line 114 of file SymLite-elf.C.
References Dyninst::Elf_X_Data::d_buf(), Dyninst::Elf_X::e_machine(), Dyninst::Elf_X::e_shnum(), Dyninst::Elf_X::e_shstrndx(), elf, Dyninst::Elf_X_Shdr::get_data(), Dyninst::Elf_X::get_shdr(), need_odp, odp_section, and Dyninst::Elf_X_Shdr::sh_name().
Referenced by SymElf().
| bool SymElf::isValidSection | ( | Section_t | sec | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 581 of file SymLite-elf.C.
References Dyninst::Section_t::i1.
Referenced by getSectionAddress(), and getSectionName().
| bool SymElf::isValidSymbol | ( | const Symbol_t & | sym | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 358 of file SymLite-elf.C.
References Dyninst::Symbol_t::i2, and INVALID_SYM_CODE.
| Symbol_t SymElf::lookupCachedSymbol | ( | Dyninst::Offset | offset | ) | [private] |
Definition at line 462 of file SymLite-elf.C.
References cache, cache_size, Dyninst::Elf_X_Data::d_buf(), Dyninst::Elf_X_Data::d_size(), elf, Dyninst::Elf_X_Shdr::get_data(), Dyninst::Elf_X::get_shdr(), Dyninst::Elf_X_Data::get_sym(), Dyninst::Symbol_t::i2, INVALID_SYM_CODE, MAKE_SYMBOL, SET_SYM_CACHEINDEX, Dyninst::Elf_X_Shdr::sh_link(), Dyninst::Elf_X_Sym::st_entsize(), Dyninst::Elf_X_Sym::st_name(), sym_sections, sym_sections_size, Dyninst::SymCacheEntry::symaddress, and Dyninst::SymCacheEntry::symloc.
Referenced by getContainingSymbol().
| unsigned SymElf::numSegments | ( | ) | [virtual] |
Implements Dyninst::SymReader.
Definition at line 273 of file SymLite-elf.C.
References Dyninst::Elf_X::e_phnum(), and elf.
friend class SymElfFactory [friend] |
Definition at line 47 of file SymLite-elf.h.
const char* Dyninst::SymElf::buffer [private] |
Definition at line 55 of file SymLite-elf.h.
Referenced by getInterpreterName().
unsigned long Dyninst::SymElf::buffer_size [private] |
Definition at line 56 of file SymLite-elf.h.
Referenced by SymElf().
SymCacheEntry* Dyninst::SymElf::cache [private] |
Definition at line 62 of file SymLite-elf.h.
Referenced by createSymCache(), getContainingSymbol(), getDemangledName(), getSymbolOffset(), lookupCachedSymbol(), and ~SymElf().
unsigned Dyninst::SymElf::cache_size [private] |
Definition at line 63 of file SymLite-elf.h.
Referenced by createSymCache(), lookupCachedSymbol(), and ~SymElf().
Definition at line 100 of file SymLite-elf.h.
Referenced by Dyninst::SymElfFactory::openSymbolReader(), and SymElf().
Elf_X* Dyninst::SymElf::elf [private] |
Definition at line 49 of file SymLite-elf.h.
Referenced by createSymCache(), getAddressWidth(), getContainingSymbol(), getElfHandle(), getInterpreterName(), getSectionAddress(), getSectionByAddress(), getSectionByName(), getSectionName(), getSegment(), getSymbolByName(), init(), lookupCachedSymbol(), numSegments(), SymElf(), and ~SymElf().
int Dyninst::SymElf::fd [private] |
Definition at line 50 of file SymLite-elf.h.
Referenced by getFD(), getInterpreterName(), SymElf(), and ~SymElf().
std::string Dyninst::SymElf::file [private] |
Definition at line 54 of file SymLite-elf.h.
Referenced by Dyninst::SymElfFactory::closeSymbolReader().
bool Dyninst::SymElf::need_odp [private] |
Definition at line 51 of file SymLite-elf.h.
Referenced by getSymOffset(), getSymTOC(), and init().
Elf_X_Shdr* Dyninst::SymElf::odp_section [private] |
Definition at line 52 of file SymLite-elf.h.
Referenced by getSymOffset(), getSymTOC(), and init().
Definition at line 99 of file SymLite-elf.h.
Referenced by Dyninst::SymElfFactory::closeSymbolReader(), and Dyninst::SymElfFactory::openSymbolReader().
Elf_X_Shdr* Dyninst::SymElf::sym_sections [private] |
Definition at line 65 of file SymLite-elf.h.
Referenced by createSymCache(), lookupCachedSymbol(), and ~SymElf().
unsigned Dyninst::SymElf::sym_sections_size [private] |
Definition at line 66 of file SymLite-elf.h.
Referenced by createSymCache(), lookupCachedSymbol(), and ~SymElf().
1.6.1