diff options
| author | Kostya Serebryany <kcc@google.com> | 2018-06-07 01:40:20 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2018-06-07 01:40:20 +0000 |
| commit | 67af99235fa24c031a0efcd074b401c66b843f0c (patch) | |
| tree | c347b77e257d8ed7dc1443060a61b74e1d93b786 /compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.h | |
| parent | 177b458c8a42e5edac291ab39e90012b3df63090 (diff) | |
| download | bcm5719-llvm-67af99235fa24c031a0efcd074b401c66b843f0c.tar.gz bcm5719-llvm-67af99235fa24c031a0efcd074b401c66b843f0c.zip | |
[libFuzzer] make the corpus elements aware of their data flow traces
llvm-svn: 334158
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.h')
| -rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.h b/compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.h index 2b7b71fdbfa..1511430c354 100644 --- a/compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.h +++ b/compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.h @@ -31,9 +31,25 @@ #include "FuzzerDefs.h" +#include <unordered_map> +#include <vector> +#include <string> + namespace fuzzer { -struct DataFlowTrace { +class DataFlowTrace { + public: void Init(const std::string &DirPath, const std::string &FocusFunction); + void Clear() { Traces.clear(); } + const Vector<bool> *Get(const std::string &InputSha1) const { + auto It = Traces.find(InputSha1); + if (It != Traces.end()) + return &It->second; + return nullptr; + } + + private: + // Input's sha1 => DFT for the FocusFunction. + std::unordered_map<std::string, Vector<bool> > Traces; }; } // namespace fuzzer |

