Я хочу извлечь CG из исходного кода путем LLVM. Но я потерпел неудачу. Есть только некоторые cfgs, а не cg.
Я использую AFLGo для фаззинга некоторых проектов. Компилятор LLVM-clang. ОС Ubuntu 16.04. Я уже собрал LLVM и Clang (версия 5.0.0).
Существует исходный код CallGraphSCCPass.cpp.
CallGraphSCCPass.cpp
// CGPassManager
/// CGPassManager manages FPPassManagers and CallGraphSCCPasses.
namespace {
class CGPassManager : public ModulePass, public PMDataManager {
public:
static char ID;
explicit CGPassManager()
: ModulePass(ID), PMDataManager() { }
/// Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the module, and if so, return
true.
bool runOnModule(Module &M) override;
using ModulePass::doInitialization;
using ModulePass::doFinalization;
bool doInitialization(CallGraph &CG);
bool doFinalization(CallGraph &CG);
/// Pass Manager itself does not invalidate any analysis info.
void getAnalysisUsage(AnalysisUsage &Info) const override {
// CGPassManager walks SCC and it needs CallGraph.
Info.addRequired<CallGraphWrapperPass>();
Info.setPreservesAll();
}
StringRef getPassName() const override { return "CallGraph Pass
Manager"; }
PMDataManager *getAsPMDataManager() override { return this; }
Pass *getAsPass() override { return this; }
// Print passes managed by this manager
void dumpPassStructure(unsigned Offset) override {
errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index);
P->dumpPassStructure(Offset + 1);
dumpLastUses(P, Offset+1);
}
}
Есть только некоторые cfgs, но не cg.