我在 Clang 中使用 clang sanitizer。
下面的命令从链接复制到官方文档: http: //llvm.org/releases/3.7.0/tools/clang/docs/SanitizerCoverage.html
$ clang++ -g cov.cc -fsanitize=address -fsanitize-coverage=bb
但是,它给了我下面的错误消息
clang-3.7: error: invalid value 'bb' in '-fsanitize-coverage=bb'
我bb
在上面更改为edge
或func
但它们都不起作用,而上面的链接说:
SanitizerCoverage can be used with AddressSanitizer, LeakSanitizer, MemorySanitizer, and UndefinedBehaviorSanitizer. In
除了 -fsanitize=,还传递以下编译时标志之一:
-fsanitize-coverage=func for function-level coverage (very fast). -fsanitize-coverage=bb for basic-block-level coverage (may add up to 30% extra slowdown). -fsanitize-coverage=edge for edge-level coverage (up to 40% slowdown).
我正在使用 Ubuntu 14。