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


C++ DWARFContext::getAppleNames方法代码示例

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


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

示例1: dumpObjectFile

static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename,
                           raw_ostream &OS) {
  logAllUnhandledErrors(DICtx.loadRegisterInfo(Obj), errs(),
                        Filename.str() + ": ");
  // The UUID dump already contains all the same information.
  if (!(DumpType & DIDT_UUID) || DumpType == DIDT_All)
    OS << Filename << ":\tfile format " << Obj.getFileFormatName() << '\n';

  // Handle the --lookup option.
  if (Lookup)
    return lookup(DICtx, Lookup, OS);

  // Handle the --name option.
  if (!Name.empty()) {
    StringSet<> Names;
    for (auto name : Name)
      Names.insert((IgnoreCase && !UseRegex) ? StringRef(name).lower() : name);

    filterByName(Names, DICtx.compile_units(), OS);
    filterByName(Names, DICtx.dwo_compile_units(), OS);
    return true;
  }

  // Handle the --find option and lower it to --debug-info=<offset>.
  if (!Find.empty()) {
    DumpOffsets[DIDT_ID_DebugInfo] = [&]() -> llvm::Optional<uint64_t> {
      for (auto Name : Find) {
        auto find = [&](const DWARFAcceleratorTable &Accel)
            -> llvm::Optional<uint64_t> {
          for (auto Entry : Accel.equal_range(Name))
            for (auto Atom : Entry)
              if (auto Offset = Atom.getAsSectionOffset())
                return Offset;
          return None;
        };
        if (auto Offset = find(DICtx.getAppleNames()))
          return DumpOffsets[DIDT_ID_DebugInfo] = *Offset;
        if (auto Offset = find(DICtx.getAppleTypes()))
          return DumpOffsets[DIDT_ID_DebugInfo] = *Offset;
        if (auto Offset = find(DICtx.getAppleNamespaces()))
          return DumpOffsets[DIDT_ID_DebugInfo] = *Offset;
      }
      return None;
    }();
    // Early exit if --find was specified but the current file doesn't have it.
    if (!DumpOffsets[DIDT_ID_DebugInfo])
      return true;
  }

  // Dump the complete DWARF structure.
  DICtx.dump(OS, getDumpOpts(), DumpOffsets);
  return true;
}
开发者ID:BNieuwenhuizen,项目名称:llvm,代码行数:53,代码来源:llvm-dwarfdump.cpp

示例2: filterByAccelName

/// Print only DIEs that have a certain name.
static void filterByAccelName(ArrayRef<std::string> Names, DWARFContext &DICtx,
                              raw_ostream &OS) {
  SmallVector<uint64_t, 4> Offsets;
  for (const auto &Name : Names) {
    getDIEOffset(DICtx.getAppleNames(), Name, Offsets);
    getDIEOffset(DICtx.getAppleTypes(), Name, Offsets);
    getDIEOffset(DICtx.getAppleNamespaces(), Name, Offsets);
    getDIEOffset(DICtx.getDebugNames(), Name, Offsets);
  }
  llvm::sort(Offsets.begin(), Offsets.end());
  Offsets.erase(std::unique(Offsets.begin(), Offsets.end()), Offsets.end());

  for (uint64_t Off: Offsets) {
    DWARFDie Die = DICtx.getDIEForOffset(Off);
    Die.dump(OS, 0, getDumpOpts());
  }
}
开发者ID:crabtw,项目名称:llvm,代码行数:18,代码来源:llvm-dwarfdump.cpp


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