Skip to content

Commit c8f2930

Browse files
committed
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
1 parent e49e125 commit c8f2930

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

afl-cov

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def main():
6060
if cargs.version:
6161
print "afl-cov-" + __version__
6262
return exit_success
63-
6463
if cargs.gcov_check or cargs.gcov_check_bin:
6564
if is_gcov_enabled(cargs):
6665
return exit_success
@@ -575,6 +574,8 @@ def lcov_gen_coverage(cov_paths, cargs):
575574
lcov_opts += ' --rc lcov_branch_coverage=1'
576575
if cargs.follow:
577576
lcov_opts += ' --follow'
577+
if cargs.clang:
578+
lcov_opts += ' --gcov-tool afl-cov--wrapper '
578579

579580
run_cmd(cargs.lcov_path \
580581
+ lcov_opts
@@ -800,6 +801,8 @@ def init_tracking(cov_paths, cargs):
800801
lcov_opts = ''
801802
if cargs.enable_branch_coverage:
802803
lcov_opts += ' --rc lcov_branch_coverage=1 '
804+
if cargs.clang:
805+
lcov_opts += ' --gcov-tool afl-cov--wrapper '
803806

804807
### reset code coverage counters - this is done only once as
805808
### afl-cov is spinning up even if AFL is running in parallel mode
@@ -1204,6 +1207,8 @@ def parse_cmdline():
12041207
help="Print version and exit", default=False)
12051208
p.add_argument("-q", "--quiet", action='store_true',
12061209
help="Quiet mode", default=False)
1210+
p.add_argument("--clang", action='store_true',
1211+
help="Support clang-based (afl-clang-fast) instrumentation", default=False)
12071212

12081213
return p.parse_args()
12091214

afl-cov-wrapper

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec ${AFL_COV_LLVM:-llvm-cov} gcov "$@"

0 commit comments

Comments
 (0)