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) \
318 s->
Format(
"[{0,3}] 0x{1,16:x} 0x{2,16:x} 0x{3,8:x} 0x{4,2:x} ({5,-10} "
319 "{-6,13}) 0x{7,-2:x} 0x{8,4:x} ({9,-10}) {10}\n",
329 const bool parsing_32 = byte_size == 4;
372 const bool parsing_32 = byte_size == 4;
lldb::SectionSP GetSectionAtIndex(size_t idx) const
llvm::StringRef GetName() const
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes to the stream.
ByteOrder
Byte ordering definitions.
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.
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.
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.
unsigned char getType() const
Returns the type attribute of the st_info member.
static llvm::StringRef sectionIndexToString(elf_half shndx, const lldb_private::SectionList *section_list)
static llvm::StringRef typeToString(unsigned char type)
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.
elf_word st_name
Symbol name string index.
elf_xword st_size
Size of the symbol or zero.
static llvm::StringRef bindingToString(unsigned char binding)
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.