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


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

本文整理汇总了C++中DataExtractor::ExtractBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ DataExtractor::ExtractBytes方法的具体用法?C++ DataExtractor::ExtractBytes怎么用?C++ DataExtractor::ExtractBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataExtractor的用法示例。


在下文中一共展示了DataExtractor::ExtractBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetSize

Error
ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch)
{
    Error error;
    ByteOrder byteorder = data.GetByteOrder();
    if (GetSize(arch) > data.GetByteSize())
    {
        error.SetErrorStringWithFormat("NT_PRPSINFO size should be %lu, but the remaining bytes are: %lu",
                                       GetSize(arch), data.GetByteSize());
        return error;
    }

    switch(arch.GetCore())
    {
        case ArchSpec::eCore_s390x_generic:
        case ArchSpec::eCore_x86_64_x86_64:
            data.ExtractBytes(0, sizeof(ELFLinuxPrPsInfo), byteorder, this);
            break;
        case ArchSpec::eCore_x86_32_i386:
        case ArchSpec::eCore_x86_32_i486:
        {
            // Parsing from a 32 bit ELF core file, and populating/reusing the structure
            // properly, because the struct is for the 64 bit version
            size_t size = 0;
            offset_t offset = 0;

            pr_state = data.GetU8(&offset);
            pr_sname = data.GetU8(&offset);
            pr_zomb = data.GetU8(&offset);
            pr_nice = data.GetU8(&offset);

            pr_flag = data.GetU32(&offset);
            pr_uid = data.GetU16(&offset);
            pr_gid = data.GetU16(&offset);

            pr_pid = data.GetU32(&offset);
            pr_ppid = data.GetU32(&offset);
            pr_pgrp = data.GetU32(&offset);
            pr_sid = data.GetU32(&offset);

            size = 16;
            data.ExtractBytes(offset, size, byteorder, pr_fname);
            offset += size;

            size = 80;
            data.ExtractBytes(offset, size, byteorder, pr_psargs);
            offset += size;

            break;
        }
        default:
            error.SetErrorStringWithFormat("ELFLinuxPrPsInfo::%s Unknown architecture", __FUNCTION__);
            break;
    }

    return error;
}
开发者ID:Archer-sys,项目名称:lldb,代码行数:57,代码来源:ThreadElfCore.cpp

示例2: GetGPRSize

RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(
    Thread &thread, RegisterInfoInterface *register_info,
    const DataExtractor &gpregset, const DataExtractor &fpregset)
    : RegisterContextPOSIX_x86(thread, 0, register_info) {
  size_t size, len;

  size = GetGPRSize();
  m_gpregset.reset(new uint8_t[size]);
  len =
      gpregset.ExtractBytes(0, size, lldb::eByteOrderLittle, m_gpregset.get());
  if (len != size)
    m_gpregset.reset();

  size = sizeof(FXSAVE);
  m_fpregset.reset(new uint8_t[size]);
  len =
      fpregset.ExtractBytes(0, size, lldb::eByteOrderLittle, m_fpregset.get());
  if (len != size)
    m_fpregset.reset();
}
开发者ID:kraj,项目名称:lldb,代码行数:20,代码来源:RegisterContextPOSIXCore_x86_64.cpp

示例3: switch

bool
ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch)
{
    ByteOrder byteorder = data.GetByteOrder();
    size_t len;
    switch(arch.GetCore())
    {
        case ArchSpec::eCore_x86_64_x86_64:
            len = data.ExtractBytes(0, ELFLINUXPRPSINFO64_SIZE, byteorder, this);
            return len == ELFLINUXPRPSINFO64_SIZE;
        default:
            return false;
    }
}
开发者ID:AAZemlyanukhin,项目名称:freebsd,代码行数:14,代码来源:ThreadElfCore.cpp


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