mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
more DEBUGF
This commit is contained in:
@ -270,6 +270,16 @@
|
||||
\
|
||||
} while (0)
|
||||
|
||||
/* Show a prefixed debug output. */
|
||||
|
||||
#define DEBUGF(x...) \
|
||||
do { \
|
||||
\
|
||||
SAYF(cMGN "[D] " cBRI "DEBUG: " cRST x); \
|
||||
SAYF(cRST ""); \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
/* Error-checking versions of read() and write() that call RPFATAL() as
|
||||
appropriate. */
|
||||
|
||||
|
@ -268,8 +268,8 @@ struct InsTrim : public ModulePass {
|
||||
|
||||
for (auto &BB : F)
|
||||
if (BB.size() > 0) ++bb_cnt;
|
||||
SAYF(cMGN "[D] " cRST "Function %s size %zu %u\n",
|
||||
F.getName().str().c_str(), F.size(), bb_cnt);
|
||||
DEBUGF("Function %s size %zu %u\n", F.getName().str().c_str(), F.size(),
|
||||
bb_cnt);
|
||||
|
||||
}
|
||||
|
||||
|
@ -627,8 +627,7 @@ struct afl_pass : gimple_opt_pass {
|
||||
}
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"loaded allowlist with %zu file and %zu function entries\n",
|
||||
DEBUGF("loaded allowlist with %zu file and %zu function entries\n",
|
||||
allowListFiles.size(), allowListFunctions.size());
|
||||
|
||||
}
|
||||
@ -702,8 +701,7 @@ struct afl_pass : gimple_opt_pass {
|
||||
}
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"loaded denylist with %zu file and %zu function entries\n",
|
||||
DEBUGF("loaded denylist with %zu file and %zu function entries\n",
|
||||
denyListFiles.size(), denyListFunctions.size());
|
||||
|
||||
}
|
||||
@ -745,9 +743,9 @@ struct afl_pass : gimple_opt_pass {
|
||||
if (fnmatch(("*" + *it).c_str(), instFunction.c_str(), 0) == 0) {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"Function %s is in the deny function list, "
|
||||
"not instrumenting ... \n",
|
||||
DEBUGF(
|
||||
"Function %s is in the deny function list, not "
|
||||
"instrumenting ... \n",
|
||||
instFunction.c_str());
|
||||
return false;
|
||||
|
||||
@ -825,9 +823,9 @@ struct afl_pass : gimple_opt_pass {
|
||||
if (fnmatch(("*" + *it).c_str(), instFunction.c_str(), 0) == 0) {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"Function %s is in the allow function list, "
|
||||
"instrumenting ... \n",
|
||||
DEBUGF(
|
||||
"Function %s is in the allow function list, instrumenting "
|
||||
"... \n",
|
||||
instFunction.c_str());
|
||||
return true;
|
||||
|
||||
@ -859,9 +857,9 @@ struct afl_pass : gimple_opt_pass {
|
||||
if (fnmatch(("*" + *it).c_str(), source_file.c_str(), 0) == 0) {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"Function %s is in the allowlist (%s), "
|
||||
"instrumenting ... \n",
|
||||
DEBUGF(
|
||||
"Function %s is in the allowlist (%s), instrumenting ... "
|
||||
"\n",
|
||||
IDENTIFIER_POINTER(DECL_NAME(F->decl)),
|
||||
source_file.c_str());
|
||||
return true;
|
||||
|
@ -173,8 +173,7 @@ void initInstrumentList() {
|
||||
}
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"loaded allowlist with %zu file and %zu function entries\n",
|
||||
DEBUGF("loaded allowlist with %zu file and %zu function entries\n",
|
||||
allowListFiles.size(), allowListFunctions.size());
|
||||
|
||||
}
|
||||
@ -248,8 +247,7 @@ void initInstrumentList() {
|
||||
}
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"loaded denylist with %zu file and %zu function entries\n",
|
||||
DEBUGF("loaded denylist with %zu file and %zu function entries\n",
|
||||
denyListFiles.size(), denyListFunctions.size());
|
||||
|
||||
}
|
||||
@ -409,9 +407,9 @@ bool isInInstrumentList(llvm::Function *F) {
|
||||
if (fnmatch(("*" + *it).c_str(), instFunction.c_str(), 0) == 0) {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"Function %s is in the deny function list, "
|
||||
"not instrumenting ... \n",
|
||||
DEBUGF(
|
||||
"Function %s is in the deny function list, not instrumenting "
|
||||
"... \n",
|
||||
instFunction.c_str());
|
||||
return false;
|
||||
|
||||
@ -489,9 +487,9 @@ bool isInInstrumentList(llvm::Function *F) {
|
||||
if (fnmatch(("*" + *it).c_str(), instFunction.c_str(), 0) == 0) {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"Function %s is in the allow function list, "
|
||||
"instrumenting ... \n",
|
||||
DEBUGF(
|
||||
"Function %s is in the allow function list, instrumenting "
|
||||
"... \n",
|
||||
instFunction.c_str());
|
||||
return true;
|
||||
|
||||
@ -523,9 +521,9 @@ bool isInInstrumentList(llvm::Function *F) {
|
||||
if (fnmatch(("*" + *it).c_str(), source_file.c_str(), 0) == 0) {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"Function %s is in the allowlist (%s), "
|
||||
"instrumenting ... \n",
|
||||
DEBUGF(
|
||||
"Function %s is in the allowlist (%s), instrumenting ... "
|
||||
"\n",
|
||||
F->getName().str().c_str(), source_file.c_str());
|
||||
return true;
|
||||
|
||||
|
@ -105,14 +105,13 @@ bool AFLcheckIfInstrument::runOnModule(Module &M) {
|
||||
if (isInInstrumentList(&F)) {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST "function %s is in the instrument file list\n",
|
||||
DEBUGF("function %s is in the instrument file list\n",
|
||||
F.getName().str().c_str());
|
||||
|
||||
} else {
|
||||
|
||||
if (debug)
|
||||
SAYF(cMGN "[D] " cRST
|
||||
"function %s is NOT in the instrument file list\n",
|
||||
DEBUGF("function %s is NOT in the instrument file list\n",
|
||||
F.getName().str().c_str());
|
||||
|
||||
auto & Ctx = F.getContext();
|
||||
|
18
src/afl-cc.c
18
src/afl-cc.c
@ -354,11 +354,8 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
||||
cc_params[cc_par_cnt++] = "-B";
|
||||
cc_params[cc_par_cnt++] = obj_path;
|
||||
|
||||
if (clang_mode) {
|
||||
if (clang_mode) { cc_params[cc_par_cnt++] = "-no-integrated-as"; }
|
||||
|
||||
cc_params[cc_par_cnt++] = "-no-integrated-as";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (compiler_mode == GCC_PLUGIN) {
|
||||
@ -708,7 +705,8 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
||||
}
|
||||
|
||||
if (getenv("AFL_NO_BUILTIN") || getenv("AFL_LLVM_LAF_TRANSFORM_COMPARES") ||
|
||||
getenv("LAF_TRANSFORM_COMPARES") || getenv("AFL_LLVM_LAF_ALL") || lto_mode) {
|
||||
getenv("LAF_TRANSFORM_COMPARES") || getenv("AFL_LLVM_LAF_ALL") ||
|
||||
lto_mode) {
|
||||
|
||||
cc_params[cc_par_cnt++] = "-fno-builtin-strcmp";
|
||||
cc_params[cc_par_cnt++] = "-fno-builtin-strncmp";
|
||||
@ -1002,16 +1000,11 @@ int main(int argc, char **argv, char **envp) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (strncmp(callname, "afl-clang", 9) == 0) {
|
||||
|
||||
clang_mode = 1;
|
||||
|
||||
if (strncmp(callname, "afl-clang++", 11) == 0) {
|
||||
|
||||
plusplus_mode = 1;
|
||||
|
||||
}
|
||||
if (strncmp(callname, "afl-clang++", 11) == 0) { plusplus_mode = 1; }
|
||||
|
||||
}
|
||||
|
||||
@ -1085,8 +1078,7 @@ int main(int argc, char **argv, char **envp) {
|
||||
if (instrument_mode == 0)
|
||||
instrument_mode = INSTRUMENT_CFG;
|
||||
else if (instrument_mode != INSTRUMENT_CFG)
|
||||
FATAL(
|
||||
"you cannot set AFL_LLVM_INSTRUMENT and AFL_LLVM_INSTRIM together");
|
||||
FATAL("you cannot set AFL_LLVM_INSTRUMENT and AFL_LLVM_INSTRIM together");
|
||||
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,9 @@ static void edit_params(int argc, char **argv) {
|
||||
instrim = 1;
|
||||
|
||||
if (debug)
|
||||
DEBUGF("passthrough=%s instrim=%d, gold_pos=%d, gold_present=%s inst_present=%s rt_present=%s rt_lto_present=%s\n",
|
||||
DEBUGF(
|
||||
"passthrough=%s instrim=%d, gold_pos=%d, gold_present=%s "
|
||||
"inst_present=%s rt_present=%s rt_lto_present=%s\n",
|
||||
passthrough ? "true" : "false", instrim, gold_pos,
|
||||
gold_present ? "true" : "false", inst_present ? "true" : "false",
|
||||
rt_present ? "true" : "false", rt_lto_present ? "true" : "false");
|
||||
|
Reference in New Issue
Block a user