用什么来代替挡泥板用gcc / LLVM(用于检测内存访问错误)? [英] What to use instead of mudflap with gcc/llvm (for detecting memory access bugs)?

查看:159
本文介绍了用什么来代替挡泥板用gcc / LLVM(用于检测内存访问错误)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

中的seems -fmudflap 功能是的从GCC删除

因此​​,我的问题:用什么,而不是它的动态分析方案外结合的读/写,未初始化的读取和这些问题。

(也许作为一个方面的问题:为什么要删除)

挡泥板的方法(instrumentalizing编译器生成在code)看起来很优雅。

背景

其他工具工具化上的机器code水平(例如净化),在源 - code水平(例如投保)或CPU的仿真(例如Valgrind的)。在工具化

的挡泥板方法有可能找到不能通过的valgrind被检测到的错误或纯化的电位(例如基于堆栈数组访问错误)。它也比其他方法更轻便。

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


解决方案

-fsanitize 是直接更换 -fmudflap 的。引述GCC 4.8.2手册页:


  -fsanitize =地址
      启用AddressSanitizer,一个快速的内存错误检测器。内存访问
      说明将进行检测,检测出的越界和使用,离职后
      免费的错误。见< HTTP://$c$c.google.com/p/address-sanitizer/>更多
      细节。  -fsanitize =螺纹
      启用ThreadSanitizer,一个快速的数据竞争检测器。内存访问
      说明将进行检测,检测数据竞争错误。看到
      < HTTP://$c$c.google.com/p/data-race-test/wiki/ThreadSanitizer>对于
      更多细节。


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

It seems that the -fmudflap feature was removed from GCC.

Thus my question: what to use instead of it for dynamically analyzing programs for out-of-bound read/writes, uninitialized reads and such issues?

(and perhaps as a side question: why was it removed?)

The approach of mudflap (instrumentalizing generated code inside the compiler) looks quite elegant.

Background

Other tools instrumentalize on a machine-code level (e.g. Purify), on a source-code level (e.g. Insure) or instrumentalize during the emulation of a CPU (e.g. Valgrind).

The mudflap approach has the potential to find errors which can't be detected by valgrind or purify (e.g. stack based array access errors). It is also more lightweight than other approaches.

I am searching for an open source solution.

解决方案

It looks like -fsanitize is a direct replacement of -fmudflap. To quote the GCC 4.8.2 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.

It is also available as part of LLVM (>= 3.1).

这篇关于用什么来代替挡泥板用gcc / LLVM(用于检测内存访问错误)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆