Add a loud mode for debugging libFuzzer on mac OS

This commit is contained in:
Alex Groce 2019-01-06 14:56:20 -07:00
parent f9334cdbc6
commit af4a0a2007
2 changed files with 11 additions and 1 deletions

View File

@ -56,6 +56,9 @@ int DeepState_UsingSymExec = 0;
/* Set to 1 when we're using libFuzzer. */
int DeepState_UsingLibFuzzer = 0;
/* To make libFuzzer louder on mac OS. */
int DeepState_LibFuzzerLoud = 1;
/* Array of DeepState generated strings. Impossible for there to
* be more than there are input bytes. Index stores where we are. */
char* DeepState_GeneratedStrings[DeepState_InputSize];
@ -841,6 +844,12 @@ extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
}
DeepState_UsingLibFuzzer = 1;
const char* loud = getenv("LIBFUZZER_LOUD");
if (loud != NULL) {
FLAGS_log_level = 0;
DeepState_LibFuzzerLoud = 1;
}
struct DeepState_TestInfo *test = NULL;

View File

@ -69,13 +69,14 @@ enum {
};
extern int DeepState_UsingLibFuzzer;
extern int DeepState_LibFuzzerLoud;
char DeepState_LogBuf[DeepState_LogBufSize + 1] = {};
/* Log a C string. */
DEEPSTATE_NOINLINE
void DeepState_Log(enum DeepState_LogLevel level, const char *str) {
if ((DeepState_UsingLibFuzzer && (level < DeepState_LogExternal)) ||
if ((DeepState_UsingLibFuzzer && !DeepState_LibFuzzerLoud && (level < DeepState_LogExternal)) ||
(level < FLAGS_log_level)) {
return;
}