It seems that -fmudflap
feature是removed来自海湾合作委员会。
因此我的问题是:使用什么代替它来动态分析程序的越界读/写、未初始化的读取等问题?
(也许还有一个附带问题:为什么要删除它?)
mudflap 的方法(在编译器内部工具化生成的代码)看起来非常优雅。
背景
其他工具在机器代码级别(例如 Purify)、源代码级别(例如 Insure)或在 CPU 仿真期间进行工具化(例如 Valgrind)。
mudflap 方法有可能发现 valgrind 或 purify 无法检测到的错误(例如,基于堆栈的数组访问错误)。它也比其他方法更轻量级。
我正在寻找开源解决方案。
最佳答案
它looks像 -fsanitize
是 -fmudflap
的直接替代品。引用GCC 4.8.5 man page :
-fsanitize=address Enable AddressSanitizer, a fast memory error detector. Memory access instructions will be instrumented to detect out-of-bounds and use-after- free bugs. See <http://code.google.com/p/address-sanitizer/> for more details. -fsanitize=thread Enable ThreadSanitizer, a fast data race detector. Memory access instructions will be instrumented to detect data race bugs. See <http://code.google.com/p/data-race-test/wiki/ThreadSanitizer> for more details.
它也可以作为 part of LLVM 获得(>= 3.1).
关于c - 用什么代替 gcc/llvm 的 mudflap(用于检测内存访问错误)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19989323/