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

似乎 -fmudflap function 已从 GCC中删除 。

因此,我的问题是:使用什么来代替它来动态分析程序的超出读/写,未初始化的读取和此类问题?

(也许作为一个附带问题:它为什么被删除了?)

mudflap的方法(在编译器中使用工具化生成的代码)看起来非常优雅。

背景

其他工具在源代码级别(例如Insure)上对机器代码级别(例如Purify)进行工具化,或者在仿真CPU(例如Valgrind)期间进行工具化。

mudflap方法有可能找到valgrind或purify无法检测到的错误(例如,基于堆栈的arrays访问错误)。 它比其他方法更轻巧。

我正在寻找一个开源解决方案。

看起来 -fsanitize-fsanitize的直接替代-fmudflap 。 引用GCC 4.8.2手册页:

  -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  for more details. -fsanitize=thread Enable ThreadSanitizer, a fast data race detector. Memory access instructions will be instrumented to detect data race bugs. See  for more details. 

它也可作为LLVM的一部分 (> = 3.1)。

清洁剂在llvm中比在gcc中更先进,因为主要组对llvm有贡献,然后其他人将其移植到gcc。

http://llvm.org/devmtg/2012-11/#talk4

作者在2012年提供的关于消毒杀菌剂的信息。