aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerIO.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-02-04 19:10:20 +0000
committerKostya Serebryany <kcc@google.com>2015-02-04 19:10:20 +0000
commit5b266a8a23e79c6ebff90699395a2c5e3f0ef91a (patch)
tree4abbef2db76de874b1c37c5a58b4c08b11ee67b6 /llvm/lib/Fuzzer/FuzzerIO.cpp
parent86abe35cebeedd50b2eff579e3a93057165dbd09 (diff)
downloadllvm-5b266a8a23e79c6ebff90699395a2c5e3f0ef91a.zip
llvm-5b266a8a23e79c6ebff90699395a2c5e3f0ef91a.tar.gz
llvm-5b266a8a23e79c6ebff90699395a2c5e3f0ef91a.tar.bz2
[fuzzer] make multi-process execution more verbose; fix mutation to actually respect mutation depth and to never produce empty units
llvm-svn: 228170
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerIO.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerIO.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerIO.cpp b/llvm/lib/Fuzzer/FuzzerIO.cpp
index 4e0ac81..224808c 100644
--- a/llvm/lib/Fuzzer/FuzzerIO.cpp
+++ b/llvm/lib/Fuzzer/FuzzerIO.cpp
@@ -9,6 +9,8 @@
// IO functions.
//===----------------------------------------------------------------------===//
#include "FuzzerInternal.h"
+#include <iostream>
+#include <iterator>
#include <fstream>
#include <dirent.h>
namespace fuzzer {
@@ -31,6 +33,12 @@ Unit FileToVector(const std::string &Path) {
std::istreambuf_iterator<char>());
}
+void CopyFileToErr(const std::string &Path) {
+ std::ifstream T(Path);
+ std::copy(std::istreambuf_iterator<char>(T), std::istreambuf_iterator<char>(),
+ std::ostream_iterator<char>(std::cerr, ""));
+}
+
void WriteToFile(const Unit &U, const std::string &Path) {
std::ofstream OF(Path);
OF.write((const char*)U.data(), U.size());