19using namespace llvm::ELF;
29 *value = data.
GetMaxU64(offset, byte_size);
30 return *offset != saved_offset;
35 uint32_t byte_size, uint32_t count) {
38 for (uint32_t i = 0; i < count; ++i, ++value) {
39 if (!
GetMaxU64(data, offset, value, byte_size)) {
40 *offset = saved_offset;
51 *value = data.
GetMaxS64(offset, byte_size);
52 return *offset != saved_offset;
57 uint32_t byte_size, uint32_t count) {
60 for (uint32_t i = 0; i < count; ++i, ++value) {
61 if (!
GetMaxS64(data, offset, value, byte_size)) {
62 *offset = saved_offset;
74 if (
e_ident[EI_DATA] == ELFDATA2MSB)
76 if (
e_ident[EI_DATA] == ELFDATA2LSB)
101 bool ok = section_zero.
Parse(sh_data, &offset);
120 const unsigned byte_size =
Is32Bit() ? 4 : 8;
158 return memcmp(magic, ElfMagic, strlen(ElfMagic)) == 0;
162 unsigned address_size = 0;
164 switch (magic[EI_CLASS]) {
181 assert(
false &&
"architecture not supported");
184 slot = R_PPC_JMP_SLOT;
187 slot = R_PPC64_JMP_SLOT;
191 slot = R_386_JUMP_SLOT;
194 slot = R_X86_64_JUMP_SLOT;
197 slot = R_ARM_JUMP_SLOT;
200 slot = R_HEX_JMP_SLOT;
203 slot = R_AARCH64_JUMP_SLOT;
206 slot = R_MIPS_JUMP_SLOT;
209 slot = R_390_JMP_SLOT;
212 slot = R_RISCV_JUMP_SLOT;
215 slot = R_LARCH_JUMP_SLOT;
259#define ENUM_TO_CSTR(e) \
317 s->
Printf(
"[%3u] 0x%16.16" PRIx64
" 0x%16.16" PRIx64
318 " 0x%8.8x 0x%2.2x (%-10s %-13s) 0x%2.2x 0x%4.4x (%-10s) %s\n",
328 const bool parsing_32 = byte_size == 4;
371 const bool parsing_32 = byte_size == 4;
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
lldb::SectionSP GetSectionAtIndex(size_t idx) const
ConstString GetName() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
ByteOrder
Byte ordering definitions.
Represents an entry in an ELF dynamic table.
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFDynamic entry from the given DataExtractor starting at position offset.
elf_sxword d_tag
Type of dynamic table entry.
Represents a relocation entry with an implicit addend.
elf_addr r_offset
Address of reference.
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFRel entry from the given DataExtractor starting at position offset.
Represents a relocation entry with an explicit addend.
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFRela entry from the given DataExtractor starting at position offset.
elf_sxword r_addend
Constant part of expression.
elf_addr r_offset
Address of reference.
Represents a symbol within an ELF symbol table.
static const char * typeToCString(unsigned char type)
unsigned char getType() const
Returns the type attribute of the st_info member.
static const char * bindingToCString(unsigned char binding)
elf_half st_shndx
Section to which this symbol applies.
unsigned char st_info
Symbol type and binding attributes.
unsigned char getBinding() const
Returns the binding attribute of the st_info member.
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFSymbol entry from the given DataExtractor starting at position offset.
elf_addr st_value
Absolute or relocatable address.
static const char * sectionIndexToCString(elf_half shndx, const lldb_private::SectionList *section_list)
elf_word st_name
Symbol name string index.
elf_xword st_size
Size of the symbol or zero.
void Dump(lldb_private::Stream *s, uint32_t idx, const lldb_private::DataExtractor *strtab_data, const lldb_private::SectionList *section_list)
unsigned char st_other
Reserved for future use.