summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-02-19 18:45:37 +0000
committerKostya Serebryany <kcc@google.com>2015-02-19 18:45:37 +0000
commit016852c3963b43c22bc385859178cf132eee22f1 (patch)
tree8643b5f6e8b395bbf295a836c977b03d44518791 /llvm/lib/Fuzzer/FuzzerLoop.cpp
parent0897091730aa361d13a34495a0e81613e43c0bb6 (diff)
downloadbcm5719-llvm-016852c3963b43c22bc385859178cf132eee22f1.tar.gz
bcm5719-llvm-016852c3963b43c22bc385859178cf132eee22f1.zip
[fuzzer] split main() into FuzzerDriver() that takes a callback as a parameter and a tiny main() in a separate file
llvm-svn: 229882
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 9c65f257d9c..1529d06b1cc 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -14,9 +14,6 @@
#include <algorithm>
#include <iostream>
-// This function should be defined by the user.
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size);
-
namespace fuzzer {
// static
@@ -107,7 +104,7 @@ static uintptr_t HashOfArrayOfPCs(uintptr_t *PCs, uintptr_t NumPCs) {
// e.g. test/FullCoverageSetTest.cpp. FIXME: make it scale.
size_t Fuzzer::RunOneMaximizeFullCoverageSet(const Unit &U) {
__sanitizer_reset_coverage();
- TestOneInput(U.data(), U.size());
+ Callback(U.data(), U.size());
uintptr_t *PCs;
uintptr_t NumPCs =__sanitizer_get_coverage_guards(&PCs);
if (FullCoverageSets.insert(HashOfArrayOfPCs(PCs, NumPCs)).second)
@@ -117,7 +114,7 @@ size_t Fuzzer::RunOneMaximizeFullCoverageSet(const Unit &U) {
size_t Fuzzer::RunOneMaximizeTotalCoverage(const Unit &U) {
size_t OldCoverage = __sanitizer_get_total_unique_coverage();
- TestOneInput(U.data(), U.size());
+ Callback(U.data(), U.size());
size_t NewCoverage = __sanitizer_get_total_unique_coverage();
if (!(TotalNumberOfRuns & (TotalNumberOfRuns - 1)) && Options.Verbosity) {
size_t Seconds = secondsSinceProcessStartUp();
OpenPOWER on IntegriCloud