本文整理汇总了C++中ObjectFile::getFileFormatName方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectFile::getFileFormatName方法的具体用法?C++ ObjectFile::getFileFormatName怎么用?C++ ObjectFile::getFileFormatName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectFile
的用法示例。
在下文中一共展示了ObjectFile::getFileFormatName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 void DumpObjectFile(ObjectFile &Obj, Twine Filename) {
std::unique_ptr<DIContext> DICtx(new DWARFContextInMemory(Obj));
outs() << Filename.str() << ":\tfile format " << Obj.getFileFormatName()
<< "\n\n";
// Dump the complete DWARF structure.
DICtx->dump(outs(), DumpType, false, SummarizeTypes);
}
示例3: 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;
}
示例4: test_desobj
void test_desobj()
{
ErrorOr<ObjectFile *> objfile = ObjectFile::createObjectFile("/usr/lib/libQtCore.so");
ObjectFile *pobj = objfile.get();
qDebug()<<"heheho"<<pobj->getFileFormatName().data();
int i = 0;
DynamicLibrary dlib = DynamicLibrary::getPermanentLibrary("/usr/lib/libQt5Core.so");
qDebug()<<dlib.isValid();
void *addr = dlib.SearchForAddressOfSymbol("_ZN7QString4chopEi");
qDebug()<<"addr:"<<addr;
}
示例5: verifyObjectFile
static bool verifyObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
Twine Filename, raw_ostream &OS) {
// Verify the DWARF and exit with non-zero exit status if verification
// fails.
raw_ostream &stream = Quiet ? nulls() : OS;
stream << "Verifying " << Filename.str() << ":\tfile format "
<< Obj.getFileFormatName() << "\n";
bool Result = DICtx.verify(stream, getDumpOpts());
if (Result)
stream << "No errors.\n";
else
stream << "Errors detected.\n";
return Result;
}
示例6: VerifyObjectFile
static bool VerifyObjectFile(ObjectFile &Obj, Twine Filename) {
std::unique_ptr<DIContext> DICtx(new DWARFContextInMemory(Obj));
// Verify the DWARF and exit with non-zero exit status if verification
// fails.
raw_ostream &stream = Quiet ? nulls() : outs();
stream << "Verifying " << Filename.str() << ":\tfile format "
<< Obj.getFileFormatName() << "\n";
bool Result = DICtx->verify(stream, DumpType);
if (Result)
stream << "No errors.\n";
else
stream << "Errors detected.\n";
return Result;
}