llvm/compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.cpp

//===- FuzzerDataFlowTrace.cpp - DataFlowTrace                ---*- C++ -* ===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// fuzzer::DataFlowTrace
//===----------------------------------------------------------------------===//

#include "FuzzerDataFlowTrace.h"

#include "FuzzerCommand.h"
#include "FuzzerIO.h"
#include "FuzzerRandom.h"
#include "FuzzerSHA1.h"
#include "FuzzerUtil.h"

#include <cstdlib>
#include <fstream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

namespace fuzzer {
static const char *kFunctionsTxt =;

bool BlockCoverage::AppendCoverage(const std::string &S) {}

// Coverage lines have this form:
// CN X Y Z T
// where N is the number of the function, T is the total number of instrumented
// BBs, and X,Y,Z, if present, are the indices of covered BB.
// BB #0, which is the entry block, is not explicitly listed.
bool BlockCoverage::AppendCoverage(std::istream &IN) {}

// Assign weights to each function.
// General principles:
//   * any uncovered function gets weight 0.
//   * a function with lots of uncovered blocks gets bigger weight.
//   * a function with a less frequently executed code gets bigger weight.
std::vector<double> BlockCoverage::FunctionWeights(size_t NumFunctions) const {}

void DataFlowTrace::ReadCoverage(const std::string &DirPath) {}

static void DFTStringAppendToVector(std::vector<uint8_t> *DFT,
                                    const std::string &DFTString) {}

// converts a string of '0' and '1' into a std::vector<uint8_t>
static std::vector<uint8_t> DFTStringToVector(const std::string &DFTString) {}

static bool ParseError(const char *Err, const std::string &Line) {}

// TODO(metzman): replace std::string with std::string_view for
// better performance. Need to figure our how to use string_view on Windows.
static bool ParseDFTLine(const std::string &Line, size_t *FunctionNum,
                         std::string *DFTString) {}

bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
                         std::vector<SizedFile> &CorporaFiles, Random &Rand) {}

int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath,
                    const std::vector<SizedFile> &CorporaFiles) {}

}  // namespace fuzzer