我正在和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。