c - 用什么代替 gcc/llvm 的 mudflap(用于检测内存访问错误)?

标签 c gcc llvm instrumentation

It seems that -fmudflap featureremoved来自海湾合作委员会。

因此我的问题是:使用什么代替它来动态分析程序的越界读/写、未初始化的读取等问题?

(也许还有一个附带问题:为什么要删除它?)

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/

相关文章:

c - 为什么在函数 block 中定义枚举可能是一种不好的做法?

c - 在 C 函数中传递字符串

c - 显示字符ASCII码及出现次数

c++ - SDL2 窗口在 raspbian 上不显示

c - strstr() 在 gcc 和 VS 中的实现是否具有线性复杂度?

c++ - 如何使用 lldb 访问 map<std::string, int> 元素?

c - Linux-MIPS 系统调用保存的寄存器?

c - 如何覆盖 C 编译器将结构中的字大小变量与字边界对齐

clang - 如何查看 Clang AST?

clang - Clang 项目的 AST