[llvm] r292738 - [libFuzzer] Portable implementation of `IsInterestingCoverageFile()`.
Marcos Pividori via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 21 17:27:48 PST 2017
Author: mpividori
Date: Sat Jan 21 19:27:47 2017
New Revision: 292738
URL: http://llvm.org/viewvc/llvm-project?rev=292738&view=rev
Log:
[libFuzzer] Portable implementation of `IsInterestingCoverageFile()`.
For Posix systems and Windows, we need to consider different cases.
Differential Revision: https://reviews.llvm.org/D28633
Modified:
llvm/trunk/lib/Fuzzer/FuzzerIO.h
llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerIO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIO.h?rev=292738&r1=292737&r2=292738&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.h Sat Jan 21 19:27:47 2017
@@ -40,6 +40,8 @@ std::string DirName(const std::string &F
// Returns path to a TmpDir.
std::string TmpDir();
+bool IsInterestingCoverageFile(const std::string &FileName);
+
void DupAndCloseStderr();
void CloseStdout();
Modified: llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp?rev=292738&r1=292737&r2=292738&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp Sat Jan 21 19:27:47 2017
@@ -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
Modified: llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp?rev=292738&r1=292737&r2=292738&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp Sat Jan 21 19:27:47 2017
@@ -279,6 +279,16 @@ std::string DirName(const std::string &F
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
Modified: llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp?rev=292738&r1=292737&r2=292738&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp Sat Jan 21 19:27:47 2017
@@ -66,18 +66,6 @@ void TracePC::HandleCallerCallee(uintptr
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);
More information about the llvm-commits
mailing list