当前位置: 首页>>代码示例>>C++>>正文


C++ DataExtractor::SetByteOrder方法代码示例

本文整理汇总了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;
}
开发者ID:Jean-Daniel,项目名称:lldb,代码行数:34,代码来源:ELFHeader.cpp

示例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;
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:20,代码来源:ObjectFileJIT.cpp

示例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;
}
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:36,代码来源:ObjectContainerUniversalMachO.cpp


注:本文中的lldb_private::DataExtractor::SetByteOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。