about summary refs log tree commit diff
path: root/llvm_mode/afl-llvm-common.cc
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-08-03 13:39:55 +0200
committerGitHub <noreply@github.com>2020-08-03 13:39:55 +0200
commitd5d8d664d0d4b95792aaccd16264f3a3cff48cc8 (patch)
treefa82a04acca16ea3e088b0d7d3aaec4b01ddf8f9 /llvm_mode/afl-llvm-common.cc
parent4a51cb71fb8785325dedac693cdea4648f6e5279 (diff)
parent409e4ae945ab5aeb31b1e3a1497ce5fc65226f07 (diff)
downloadafl++-d5d8d664d0d4b95792aaccd16264f3a3cff48cc8.tar.gz
Merge pull request #477 from AFLplusplus/dev
Push to stable
Diffstat (limited to 'llvm_mode/afl-llvm-common.cc')
-rw-r--r--llvm_mode/afl-llvm-common.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/llvm_mode/afl-llvm-common.cc b/llvm_mode/afl-llvm-common.cc
index 47b49358..9a884ded 100644
--- a/llvm_mode/afl-llvm-common.cc
+++ b/llvm_mode/afl-llvm-common.cc
@@ -14,6 +14,8 @@
 #include <fstream>
 
 #include <llvm/Support/raw_ostream.h>
+
+#define IS_EXTERN extern
 #include "afl-llvm-common.h"
 
 using namespace llvm;
@@ -88,6 +90,7 @@ void initInstrumentList() {
   char *instrumentListFilename = getenv("AFL_LLVM_INSTRUMENT_FILE");
   if (!instrumentListFilename)
     instrumentListFilename = getenv("AFL_LLVM_WHITELIST");
+
   if (instrumentListFilename) {
 
     std::string   line;
@@ -105,6 +108,10 @@ void initInstrumentList() {
 
   }
 
+  if (debug)
+    SAYF(cMGN "[D] " cRST "loaded instrument list with %zu entries\n",
+         myInstrumentList.size());
+
 }
 
 bool isInInstrumentList(llvm::Function *F) {
@@ -145,8 +152,6 @@ bool isInInstrumentList(llvm::Function *F) {
 
     }
 
-    (void)instLine;
-
     /* Continue only if we know where we actually are */
     if (!instFilename.str().empty()) {
 
@@ -164,6 +169,10 @@ bool isInInstrumentList(llvm::Function *F) {
           if (fnmatch(("*" + *it).c_str(), instFilename.str().c_str(), 0) ==
               0) {
 
+            if (debug)
+              SAYF(cMGN "[D] " cRST
+                        "Function %s is in the list (%s), instrumenting ... \n",
+                   F->getName().str().c_str(), instFilename.str().c_str());
             return true;
 
           }
@@ -219,12 +228,15 @@ bool isInInstrumentList(llvm::Function *F) {
 
     // we could not find out the location. in this case we say it is not
     // in the the instrument file list
-
+    if (!be_quiet)
+      WARNF(
+          "No debug information found for function %s, will not be "
+          "instrumented (recompile with -g -O[1-3]).",
+          F->getName().str().c_str());
     return false;
 
   }
 
-  //
   return false;
 
 }