#include "absl/debugging/internal/elf_mem_image.h"
#ifdef ABSL_HAVE_ELF_MEM_IMAGE
#include <string.h>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
#define VERSYM_VERSION …
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
namespace {
#if __SIZEOF_POINTER__ == 4
const int kElfClass = ELFCLASS32;
int ElfBind(const ElfW(Sym) *symbol) { return ELF32_ST_BIND(symbol->st_info); }
int ElfType(const ElfW(Sym) *symbol) { return ELF32_ST_TYPE(symbol->st_info); }
#elif __SIZEOF_POINTER__ == 8
const int kElfClass = …;
int ElfBind(const ElfW(Sym) *symbol) { … }
int ElfType(const ElfW(Sym) *symbol) { … }
#else
const int kElfClass = -1;
int ElfBind(const ElfW(Sym) *) {
ABSL_RAW_LOG(FATAL, "Unexpected word size");
return 0;
}
int ElfType(const ElfW(Sym) *) {
ABSL_RAW_LOG(FATAL, "Unexpected word size");
return 0;
}
#endif
template <typename T>
const T *GetTableElement(const ElfW(Ehdr) * ehdr, ElfW(Off) table_offset,
ElfW(Word) element_size, size_t index) { … }
}
const int ElfMemImage::kInvalidBaseSentinel = …;
ElfMemImage::ElfMemImage(const void *base) { … }
uint32_t ElfMemImage::GetNumSymbols() const { … }
const ElfW(Sym) * ElfMemImage::GetDynsym(uint32_t index) const { … }
const ElfW(Versym) *ElfMemImage::GetVersym(uint32_t index) const { … }
const ElfW(Phdr) *ElfMemImage::GetPhdr(int index) const { … }
const char *ElfMemImage::GetDynstr(ElfW(Word) offset) const { … }
const void *ElfMemImage::GetSymAddr(const ElfW(Sym) *sym) const { … }
const ElfW(Verdef) *ElfMemImage::GetVerdef(int index) const { … }
const ElfW(Verdaux) *ElfMemImage::GetVerdefAux(
const ElfW(Verdef) *verdef) const { … }
const char *ElfMemImage::GetVerstr(ElfW(Word) offset) const { … }
void ElfMemImage::Init(const void *base) { … }
bool ElfMemImage::LookupSymbol(const char *name,
const char *version,
int type,
SymbolInfo *info_out) const { … }
bool ElfMemImage::LookupSymbolByAddress(const void *address,
SymbolInfo *info_out) const { … }
ElfMemImage::SymbolIterator::SymbolIterator(const void *const image,
uint32_t index)
: … { … }
const ElfMemImage::SymbolInfo *ElfMemImage::SymbolIterator::operator->() const { … }
const ElfMemImage::SymbolInfo& ElfMemImage::SymbolIterator::operator*() const { … }
bool ElfMemImage::SymbolIterator::operator==(const SymbolIterator &rhs) const { … }
bool ElfMemImage::SymbolIterator::operator!=(const SymbolIterator &rhs) const { … }
ElfMemImage::SymbolIterator &ElfMemImage::SymbolIterator::operator++() { … }
ElfMemImage::SymbolIterator ElfMemImage::begin() const { … }
ElfMemImage::SymbolIterator ElfMemImage::end() const { … }
void ElfMemImage::SymbolIterator::Update(uint32_t increment) { … }
}
ABSL_NAMESPACE_END
}
#endif