[libFuzzer] print uncovered functions when doing -print_coverage=1

llvm-svn: 352263
This commit is contained in:
Kostya Serebryany 2019-01-26 01:33:09 +00:00
parent 2b8b2978e4
commit bb01a098b1
2 changed files with 7 additions and 6 deletions

View File

@ -245,8 +245,7 @@ void TracePC::IterateCoveredFunctions(CallBack CB) {
do {
NextFE++;
} while (NextFE < M.Stop && !(NextFE->PCFlags & 1));
if (ObservedFuncs.count(FE->PC))
CB(FE, NextFE, ObservedFuncs[FE->PC]);
CB(FE, NextFE, ObservedFuncs[FE->PC]);
}
}
}
@ -311,12 +310,13 @@ void TracePC::PrintCoverage() {
for (auto TE = First; TE < Last; TE++)
if (!ObservedPCs.count(TE->PC))
UncoveredPCs.push_back(TE->PC);
Printf("COVERED_FUNC: hits: %zd", Counter);
Printf("%sCOVERED_FUNC: hits: %zd", Counter ? "" : "UN", Counter);
Printf(" edges: %zd/%zd", NumEdges - UncoveredPCs.size(), NumEdges);
Printf(" %s %s:%zd\n", FunctionStr.c_str(), FileStr.c_str(), Line);
for (auto PC: UncoveredPCs)
Printf(" UNCOVERED_PC: %s\n",
DescribePC("%s:%l", GetNextInstructionPc(PC)).c_str());
if (Counter)
for (auto PC : UncoveredPCs)
Printf(" UNCOVERED_PC: %s\n",
DescribePC("%s:%l", GetNextInstructionPc(PC)).c_str());
};
IterateCoveredFunctions(CoveredFunctionCallback);

View File

@ -17,3 +17,4 @@ DSO-DAG: COVERED_FUNC:{{.*}}LLVMFuzzerTestOneInput{{.*}}DSOTestMain
DSO-DAG: UNCOVERED_PC:{{.*}}1
DSO-DAG: UNCOVERED_PC:{{.*}}2
DSO-DAG: UNCOVERED_PC:{{.*}}DSOTestMain
DSO-DAG: UNCOVERED_FUNC:{{.*}}Uncovered1