本文整理汇总了C++中DWARFContext::compile_units方法的典型用法代码示例。如果您正苦于以下问题:C++ DWARFContext::compile_units方法的具体用法?C++ DWARFContext::compile_units怎么用?C++ DWARFContext::compile_units使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DWARFContext
的用法示例。
在下文中一共展示了DWARFContext::compile_units方法的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()) {
filterByAccelName(Find, DICtx, OS);
return true;
}
// Dump the complete DWARF structure.
DICtx.dump(OS, getDumpOpts(), DumpOffsets);
return true;
}
示例2: 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;
}