diff options
author | David Carlier <devnexen@gmail.com> | 2019-11-09 10:37:44 +0000 |
---|---|---|
committer | David Carlier <devnexen@gmail.com> | 2019-11-09 10:37:44 +0000 |
commit | b22145d0c4d81651f25d912bb7ea5f7fed958873 (patch) | |
tree | 334896dc372fffc08d724368ab10ef644be4118b /gcc_plugin | |
parent | 99e623ef0bcbebcdd6b102020e04d65f123ff7c3 (diff) | |
download | afl++-b22145d0c4d81651f25d912bb7ea5f7fed958873.tar.gz |
gcc plugin llittle update proposal to match better LLVM's
Diffstat (limited to 'gcc_plugin')
-rw-r--r-- | gcc_plugin/afl-gcc-pass.so.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc_plugin/afl-gcc-pass.so.cc b/gcc_plugin/afl-gcc-pass.so.cc index 84e02cb8..0fa07774 100644 --- a/gcc_plugin/afl-gcc-pass.so.cc +++ b/gcc_plugin/afl-gcc-pass.so.cc @@ -401,11 +401,13 @@ class afl_pass : public gimple_opt_pass { } - virtual unsigned int execute(function *fun) { + unsigned int execute(function *fun) override { if (!myWhitelist.empty()) { bool instrumentBlock = false; + std::string instFilename; + unsigned int instLine = 0; /* EXPR_FILENAME This macro returns the name of the file in which the entity was declared, @@ -417,7 +419,8 @@ class afl_pass : public gimple_opt_pass { if (0 != strncmp("<internal>", fname, 10) && 0 != strncmp("<built-in>", fname, 10)) { - std::string instFilename(fname); + instFilename = fname; + instLine = DECL_SOURCE_LINE(fun->decl); /* Continue only if we know where we actually are */ if (!instFilename.empty()) { @@ -449,7 +452,17 @@ class afl_pass : public gimple_opt_pass { /* Either we couldn't figure out our location or the location is * not whitelisted, so we skip instrumentation. */ - if (!instrumentBlock) return 0; + if (!instrumentBlock) { + + if (!be_quiet) { + if (!instFilename.empty()) + SAYF(cYEL "[!] " cBRI "Not in whitelist, skipping %s line %u...\n", + instFilename.c_str(), instLine); + else + SAYF(cYEL "[!] " cBRI "No filename information found, skipping it"); + } + return 0; + } } |