#include "snapshot/elf/elf_image_reader.h"
#include <stddef.h>
#include <algorithm>
#include <limits>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/logging.h"
#include "base/numerics/safe_math.h"
#include "build/build_config.h"
#include "util/numeric/checked_vm_address_range.h"
namespace crashpad {
class ElfImageReader::ProgramHeaderTable { … };
template <typename PhdrType>
class ElfImageReader::ProgramHeaderTableSpecific
: public ElfImageReader::ProgramHeaderTable { … };
ElfImageReader::NoteReader::~NoteReader() = default;
ElfImageReader::NoteReader::Result ElfImageReader::NoteReader::NextNote(
std::string* name,
NoteType* type,
std::string* desc,
VMAddress* desc_address) { … }
namespace {
constexpr size_t kMaxMaxNoteSize = …;
}
ElfImageReader::NoteReader::NoteReader(const ElfImageReader* elf_reader,
const ProcessMemoryRange* range,
const ProgramHeaderTable* phdr_table,
size_t max_note_size,
const std::string& name_filter,
NoteType type_filter,
bool use_filter)
: … { … }
template <typename NhdrType>
ElfImageReader::NoteReader::Result ElfImageReader::NoteReader::ReadNote(
std::string* name,
NoteType* type,
std::string* desc,
VMAddress* desc_address) { … }
ElfImageReader::ElfImageReader()
: … { … }
ElfImageReader::~ElfImageReader() { … }
bool ElfImageReader::Initialize(const ProcessMemoryRange& memory,
VMAddress address,
bool verbose) { … }
uint16_t ElfImageReader::FileType() const { … }
bool ElfImageReader::SoName(std::string* name) { … }
bool ElfImageReader::GetDynamicSymbol(const std::string& name,
VMAddress* address,
VMSize* size) { … }
bool ElfImageReader::ReadDynamicStringTableAtOffset(VMSize offset,
std::string* string) { … }
bool ElfImageReader::GetDebugAddress(VMAddress* debug) { … }
bool ElfImageReader::GetDynamicArrayAddress(VMAddress* address) { … }
VMAddress ElfImageReader::GetProgramHeaderTableAddress() { … }
bool ElfImageReader::InitializeProgramHeaders(bool verbose) { … }
bool ElfImageReader::InitializeDynamicArray() { … }
bool ElfImageReader::InitializeDynamicSymbolTable() { … }
bool ElfImageReader::GetAddressFromDynamicArray(uint64_t tag,
bool log,
VMAddress* address) { … }
bool ElfImageReader::GetNumberOfSymbolEntriesFromDtHash(
VMSize* number_of_symbol_table_entries) { … }
bool ElfImageReader::GetNumberOfSymbolEntriesFromDtGnuHash(
VMSize* number_of_symbol_table_entries) { … }
std::unique_ptr<ElfImageReader::NoteReader> ElfImageReader::Notes(
size_t max_note_size) { … }
std::unique_ptr<ElfImageReader::NoteReader>
ElfImageReader::NotesWithNameAndType(const std::string& name,
NoteReader::NoteType type,
size_t max_note_size) { … }
const ProcessMemoryRange* ElfImageReader::Memory() const { … }
}