Skip to content

Commit

Permalink
add support for afl-clang-fast
Browse files Browse the repository at this point in the history
By default, the wrapper script will execute `llvm-cov`, which can be overriden by the environment variable AFL_COV_LLVM
  • Loading branch information
ddcc committed Aug 31, 2019
1 parent e49e125 commit c8f2930
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion afl-cov
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 2 additions & 0 deletions afl-cov-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec ${AFL_COV_LLVM:-llvm-cov} gcov "$@"

0 comments on commit c8f2930

Please sign in to comment.