本文整理汇总了C++中lldb_private::DataExtractor::SetByteOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ DataExtractor::SetByteOrder方法的具体用法?C++ DataExtractor::SetByteOrder怎么用?C++ DataExtractor::SetByteOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lldb_private::DataExtractor
的用法示例。
在下文中一共展示了DataExtractor::SetByteOrder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
ELFHeader::Parse(lldb_private::DataExtractor &data, lldb::offset_t *offset)
{
// Read e_ident. This provides byte order and address size info.
if (data.GetU8(offset, &e_ident, EI_NIDENT) == NULL)
return false;
const unsigned byte_size = Is32Bit() ? 4 : 8;
data.SetByteOrder(GetByteOrder());
data.SetAddressByteSize(byte_size);
// Read e_type and e_machine.
if (data.GetU16(offset, &e_type, 2) == NULL)
return false;
// Read e_version.
if (data.GetU32(offset, &e_version, 1) == NULL)
return false;
// Read e_entry, e_phoff and e_shoff.
if (GetMaxU64(data, offset, &e_entry, byte_size, 3) == false)
return false;
// Read e_flags.
if (data.GetU32(offset, &e_flags, 1) == NULL)
return false;
// Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and
// e_shstrndx.
if (data.GetU16(offset, &e_ehsize, 6) == NULL)
return false;
return true;
}
示例2: data_sp
size_t
ObjectFileJIT::ReadSectionData (const lldb_private::Section *section,
lldb_private::DataExtractor& section_data) const
{
if (section->GetFileSize())
{
const void *src = (void *)(uintptr_t)section->GetFileOffset();
DataBufferSP data_sp (new lldb_private::DataBufferHeap(src, section->GetFileSize()));
if (data_sp)
{
section_data.SetData (data_sp, 0, data_sp->GetByteSize());
section_data.SetByteOrder (GetByteOrder());
section_data.SetAddressByteSize (GetAddressByteSize());
return section_data.GetByteSize();
}
}
section_data.Clear();
return 0;
}
示例3: ParseHeader
bool ObjectContainerUniversalMachO::ParseHeader(
lldb_private::DataExtractor &data, llvm::MachO::fat_header &header,
std::vector<llvm::MachO::fat_arch> &fat_archs) {
bool success = false;
// Store the file offset for this universal file as we could have a universal
// .o file
// in a BSD archive, or be contained in another kind of object.
// Universal mach-o files always have their headers in big endian.
lldb::offset_t offset = 0;
data.SetByteOrder(eByteOrderBig);
header.magic = data.GetU32(&offset);
fat_archs.clear();
if (header.magic == FAT_MAGIC) {
data.SetAddressByteSize(4);
header.nfat_arch = data.GetU32(&offset);
// Now we should have enough data for all of the fat headers, so lets index
// them so we know how many architectures that this universal binary
// contains.
uint32_t arch_idx = 0;
for (arch_idx = 0; arch_idx < header.nfat_arch; ++arch_idx) {
if (data.ValidOffsetForDataOfSize(offset, sizeof(fat_arch))) {
fat_arch arch;
if (data.GetU32(&offset, &arch, sizeof(fat_arch) / sizeof(uint32_t)))
fat_archs.push_back(arch);
}
}
success = true;
} else {
memset(&header, 0, sizeof(header));
}
return success;
}