From c8f2930231858773c2cc42debebc9967106323b1 Mon Sep 17 00:00:00 2001 From: Dominic Chen Date: Fri, 30 Aug 2019 20:55:36 -0400 Subject: [PATCH] add support for afl-clang-fast By default, the wrapper script will execute `llvm-cov`, which can be overriden by the environment variable AFL_COV_LLVM --- afl-cov | 7 ++++++- afl-cov-wrapper | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 afl-cov-wrapper diff --git a/afl-cov b/afl-cov index 32318d3..22a91d8 100755 --- a/afl-cov +++ b/afl-cov @@ -60,7 +60,6 @@ def main(): if cargs.version: print "afl-cov-" + __version__ return exit_success - if cargs.gcov_check or cargs.gcov_check_bin: if is_gcov_enabled(cargs): return exit_success @@ -575,6 +574,8 @@ def lcov_gen_coverage(cov_paths, cargs): lcov_opts += ' --rc lcov_branch_coverage=1' if cargs.follow: lcov_opts += ' --follow' + if cargs.clang: + lcov_opts += ' --gcov-tool afl-cov--wrapper ' run_cmd(cargs.lcov_path \ + lcov_opts @@ -800,6 +801,8 @@ def init_tracking(cov_paths, cargs): lcov_opts = '' if cargs.enable_branch_coverage: lcov_opts += ' --rc lcov_branch_coverage=1 ' + if cargs.clang: + lcov_opts += ' --gcov-tool afl-cov--wrapper ' ### reset code coverage counters - this is done only once as ### afl-cov is spinning up even if AFL is running in parallel mode @@ -1204,6 +1207,8 @@ def parse_cmdline(): help="Print version and exit", default=False) p.add_argument("-q", "--quiet", action='store_true', help="Quiet mode", default=False) + p.add_argument("--clang", action='store_true', + help="Support clang-based (afl-clang-fast) instrumentation", default=False) return p.parse_args() diff --git a/afl-cov-wrapper b/afl-cov-wrapper new file mode 100755 index 0000000..f92cc0c --- /dev/null +++ b/afl-cov-wrapper @@ -0,0 +1,2 @@ +#!/bin/bash +exec ${AFL_COV_LLVM:-llvm-cov} gcov "$@"