使用 LLVM LibFuzzer 时 'fsantize-coverage=edge' 中的无效值 'edge'

invalid value 'edge' in 'fsantize-coverage=edge' when using LLVM LibFuzzer

http://llvm.org/docs/LibFuzzer.html 我现在正在使用 libfuzzer 做一些工作,但是当我使用官方玩具示例时。当我 运行 这个命令时:

clang++ -fsanitize=address -fsanitize-coverage=edge test-fuzzer.cc Fuzzer*.o

发生错误

clang: error: invalid value 'edge' in 'fsanitize-coverage=edge'

clang 似乎支持这个论点,但我想知道如何查看支持的值... 我通过 apt-get 和 unbuntu14.04 安装了 llvm 3.6...

fsanitize-coverage= 标志的语法已更改,如 2015 年 5 月 this commit message 中所述。这一点与您特别相关:

Original semantics of -fsanitize-coverage flag is preserved:
  * -fsanitize-coverage=0 disables the coverage
  * -fsanitize-coverage=1 is a synonym for -fsanitize-coverage=func
  * -fsanitize-coverage=2 is a synonym for -fsanitize-coverage=bb
  * -fsanitize-coverage=3 is a synonym for -fsanitize-coverage=edge
  * -fsanitize-coverage=4 is a synonym for -fsanitize-coverage=edge,indirect-calls

所以你可以试试 -fsanitize-coverage=3