forked from OSchip/llvm-project
[libFuzzer] Portable implementation of `IsInterestingCoverageFile()`.
For Posix systems and Windows, we need to consider different cases. Differential Revision: https://reviews.llvm.org/D28633 llvm-svn: 292738
This commit is contained in:
parent
403007e3c1
commit
60cc2fbba1
|
@ -40,6 +40,8 @@ std::string DirName(const std::string &FileName);
|
|||
// Returns path to a TmpDir.
|
||||
std::string TmpDir();
|
||||
|
||||
bool IsInterestingCoverageFile(const std::string &FileName);
|
||||
|
||||
void DupAndCloseStderr();
|
||||
|
||||
void CloseStdout();
|
||||
|
|
|
@ -89,6 +89,18 @@ std::string TmpDir() {
|
|||
return "/tmp";
|
||||
}
|
||||
|
||||
bool IsInterestingCoverageFile(const std::string &FileName) {
|
||||
if (FileName.find("compiler-rt/lib/") != std::string::npos)
|
||||
return false; // sanitizer internal.
|
||||
if (FileName.find("/usr/lib/") != std::string::npos)
|
||||
return false;
|
||||
if (FileName.find("/usr/include/") != std::string::npos)
|
||||
return false;
|
||||
if (FileName == "<null>")
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace fuzzer
|
||||
|
||||
#endif // LIBFUZZER_POSIX
|
||||
|
|
|
@ -279,6 +279,16 @@ std::string DirName(const std::string &FileName) {
|
|||
|
||||
std::string TmpDir() { return "TODO: implement TmpDir"; }
|
||||
|
||||
bool IsInterestingCoverageFile(const std::string &FileName) {
|
||||
if (FileName.find("Program Files") != std::string::npos)
|
||||
return false;
|
||||
if (FileName.find("compiler-rt\\lib\\") != std::string::npos)
|
||||
return false; // sanitizer internal.
|
||||
if (FileName == "<null>")
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace fuzzer
|
||||
|
||||
#endif // LIBFUZZER_WINDOWS
|
||||
|
|
|
@ -66,18 +66,6 @@ void TracePC::HandleCallerCallee(uintptr_t Caller, uintptr_t Callee) {
|
|||
HandleValueProfile(Idx);
|
||||
}
|
||||
|
||||
static bool IsInterestingCoverageFile(std::string &File) {
|
||||
if (File.find("compiler-rt/lib/") != std::string::npos)
|
||||
return false; // sanitizer internal.
|
||||
if (File.find("/usr/lib/") != std::string::npos)
|
||||
return false;
|
||||
if (File.find("/usr/include/") != std::string::npos)
|
||||
return false;
|
||||
if (File == "<null>")
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TracePC::InitializePrintNewPCs() {
|
||||
if (!DoPrintNewPCs) return;
|
||||
assert(!PrintedPCs);
|
||||
|
|
Loading…
Reference in New Issue