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


C++ COFFObjectFile::end_sections方法代码示例

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


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

示例1: read

std::vector<segment> read(const COFFObjectFile& obj) {
    std::vector<segment> segments;
    const pe32_header *pe32;
    if (error_code err = obj.getPE32Header(pe32))
        llvm_binary_fail(err);

    for (auto it = obj.begin_sections();
         it != obj.end_sections(); ++it) {
        const coff_section *s = obj.getCOFFSection(it);
        uint32_t c = static_cast<uint32_t>(s->Characteristics);
        if ( c & COFF::IMAGE_SCN_CNT_CODE ||
             c & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA ||
             c & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA )
            segments.push_back(segment(*pe32, *s));
    }
    return segments;
}
开发者ID:jamella,项目名称:bap,代码行数:17,代码来源:llvm_binary.hpp

示例2: getSymbolNMTypeChar

static error_code getSymbolNMTypeChar(COFFObjectFile &Obj, symbol_iterator I,
                                      char &Result) {
  const coff_symbol *symb = Obj.getCOFFSymbol(I);
  StringRef name;
  if (error_code ec = I->getName(name))
    return ec;
  char ret = StringSwitch<char>(name)
                 .StartsWith(".debug", 'N')
                 .StartsWith(".sxdata", 'N')
                 .Default('?');

  if (ret != '?') {
    Result = ret;
    return object_error::success;
  }

  uint32_t Characteristics = 0;
  if (symb->SectionNumber > 0) {
    section_iterator SecI = Obj.end_sections();
    if (error_code ec = I->getSection(SecI))
      return ec;
    const coff_section *Section = Obj.getCOFFSection(SecI);
    Characteristics = Section->Characteristics;
  }

  switch (symb->SectionNumber) {
  case COFF::IMAGE_SYM_UNDEFINED:
    // Check storage classes.
    if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL) {
      Result = 'w';
      return object_error::success; // Don't do ::toupper.
    } else if (symb->Value != 0)    // Check for common symbols.
      ret = 'c';
    else
      ret = 'u';
    break;
  case COFF::IMAGE_SYM_ABSOLUTE:
    ret = 'a';
    break;
  case COFF::IMAGE_SYM_DEBUG:
    ret = 'n';
    break;
  default:
    // Check section type.
    if (Characteristics & COFF::IMAGE_SCN_CNT_CODE)
      ret = 't';
    else if (Characteristics & COFF::IMAGE_SCN_MEM_READ &&
             ~Characteristics & COFF::IMAGE_SCN_MEM_WRITE) // Read only.
      ret = 'r';
    else if (Characteristics & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA)
      ret = 'd';
    else if (Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)
      ret = 'b';
    else if (Characteristics & COFF::IMAGE_SCN_LNK_INFO)
      ret = 'i';

    // Check for section symbol.
    else if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_STATIC &&
             symb->Value == 0)
      ret = 's';
  }

  if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL)
    ret = ::toupper(static_cast<unsigned char>(ret));

  Result = ret;
  return object_error::success;
}
开发者ID:abrageddon,项目名称:LLVM-LabelAll,代码行数:68,代码来源:llvm-nm.cpp


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