【问题标题】:What to use instead of mudflap with gcc/llvm (for detecting memory access bugs)?用什么来代替 gcc/llvm 的泥瓣(用于检测内存访问错误)?
【发布时间】:2013-11-14 22:02:05
【问题描述】:

It seems that -fmudflap feature 是来自 GCC 的 removed

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

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

mudflap(在编译器中对生成的代码进行工具化)的方法看起来相当优雅。

背景

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

mudflap 方法有可能发现 valgrind 或 purify 无法检测到的错误(例如基于堆栈的数组访问错误)。它也比其他方法更轻量级。

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

【问题讨论】:

    标签: c gcc llvm instrumentation


    【解决方案1】:

    looks-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 <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)。

    【讨论】:

    【解决方案2】:

    llvm 中的消毒剂也比 gcc 中先进得多,因为主要组为 llvm 做出贡献,然后其他人将其移植到 gcc。

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

    有作者在 2012 年提供的有关消毒剂的信息。

    【讨论】:

      猜你喜欢
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-11
      相关资源
      最近更新 更多