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 f32dcc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions afl-cov
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,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 +802,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 +1208,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 f32dcc8

Please sign in to comment.