| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#ifndef LLVM_FUZZER_UTIL_H |
| 13 |
#define LLVM_FUZZER_UTIL_H |
| 14 |
|
| 15 |
#include "FuzzerDefs.h" |
| 16 |
|
| 17 |
namespace fuzzer { |
| 18 |
|
| 19 |
void PrintHexArray(const Unit &U, const char *PrintAfter = ""); |
| 20 |
|
| 21 |
void PrintHexArray(const uint8_t *Data, size_t Size, |
| 22 |
const char *PrintAfter = ""); |
| 23 |
|
| 24 |
void PrintASCII(const uint8_t *Data, size_t Size, const char *PrintAfter = ""); |
| 25 |
|
| 26 |
void PrintASCII(const Unit &U, const char *PrintAfter = ""); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
bool ToASCII(uint8_t *Data, size_t Size); |
| 31 |
|
| 32 |
bool IsASCII(const Unit &U); |
| 33 |
|
| 34 |
bool IsASCII(const uint8_t *Data, size_t Size); |
| 35 |
|
| 36 |
std::string Base64(const Unit &U); |
| 37 |
|
| 38 |
void PrintPC(const char *SymbolizedFMT, const char *FallbackFMT, uintptr_t PC); |
| 39 |
|
| 40 |
std::string DescribePC(const char *SymbolizedFMT, uintptr_t PC); |
| 41 |
|
| 42 |
unsigned NumberOfCpuCores(); |
| 43 |
|
| 44 |
bool ExecuteCommandAndReadOutput(const std::string &Command, std::string *Out); |
| 45 |
|
| 46 |
|
| 47 |
void SetSignalHandler(const FuzzingOptions& Options); |
| 48 |
|
| 49 |
void SleepSeconds(int Seconds); |
| 50 |
|
| 51 |
unsigned long GetPid(); |
| 52 |
|
| 53 |
size_t GetPeakRSSMb(); |
| 54 |
|
| 55 |
int ExecuteCommand(const std::string &Command); |
| 56 |
|
| 57 |
FILE *OpenProcessPipe(const char *Command, const char *Mode); |
| 58 |
|
| 59 |
const void *SearchMemory(const void *haystack, size_t haystacklen, |
| 60 |
const void *needle, size_t needlelen); |
| 61 |
|
| 62 |
std::string CloneArgsWithoutX(const std::vector<std::string> &Args, |
| 63 |
const char *X1, const char *X2); |
| 64 |
|
| 65 |
inline std::string CloneArgsWithoutX(const std::vector<std::string> &Args, |
| 66 |
const char *X) { |
| 67 |
return CloneArgsWithoutX(Args, X, X); |
| 68 |
} |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
#endif |