bool ELFSectionHeader::Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset) { const unsigned byte_size = data.GetAddressByteSize(); // Read sh_name and sh_type. if (data.GetU32(offset, &sh_name, 2) == NULL) return false; // Read sh_flags. if (GetMaxU64(data, offset, &sh_flags, byte_size) == false) return false; // Read sh_addr, sh_off and sh_size. if (GetMaxU64(data, offset, &sh_addr, byte_size, 3) == false) return false; // Read sh_link and sh_info. if (data.GetU32(offset, &sh_link, 2) == NULL) return false; // Read sh_addralign and sh_entsize. if (GetMaxU64(data, offset, &sh_addralign, byte_size, 2) == false) return false; return true; }
bool ELFRel::Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset) { const unsigned byte_size = data.GetAddressByteSize(); // Read r_offset and r_info. if (GetMaxU64(data, offset, &r_offset, byte_size, 2) == false) return false; return true; }
bool ELFSymbol::Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset) { const unsigned byte_size = data.GetAddressByteSize(); const bool parsing_32 = byte_size == 4; // Read st_name. if (data.GetU32(offset, &st_name, 1) == NULL) return false; if (parsing_32) { // Read st_value and st_size. if (GetMaxU64(data, offset, &st_value, byte_size, 2) == false) return false; // Read st_info and st_other. if (data.GetU8(offset, &st_info, 2) == NULL) return false; // Read st_shndx. if (data.GetU16(offset, &st_shndx, 1) == NULL) return false; } else { // Read st_info and st_other. if (data.GetU8(offset, &st_info, 2) == NULL) return false; // Read st_shndx. if (data.GetU16(offset, &st_shndx, 1) == NULL) return false; // Read st_value and st_size. if (data.GetU64(offset, &st_value, 2) == NULL) return false; } return true; }
bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset) { const uint32_t byte_size = data.GetAddressByteSize(); const bool parsing_32 = byte_size == 4; // Read p_type; if (data.GetU32(offset, &p_type, 1) == NULL) return false; if (parsing_32) { // Read p_offset, p_vaddr, p_paddr, p_filesz and p_memsz. if (GetMaxU64(data, offset, &p_offset, byte_size, 5) == false) return false; // Read p_flags. if (data.GetU32(offset, &p_flags, 1) == NULL) return false; // Read p_align. if (GetMaxU64(data, offset, &p_align, byte_size) == false) return false; } else { // Read p_flags. if (data.GetU32(offset, &p_flags, 1) == NULL) return false; // Read p_offset, p_vaddr, p_paddr, p_filesz, p_memsz and p_align. if (GetMaxU64(data, offset, &p_offset, byte_size, 6) == false) return false; } return true; }
bool ELFDynamic::Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset) { const unsigned byte_size = data.GetAddressByteSize(); return GetMaxS64(data, offset, &d_tag, byte_size, 2); }