What to use instead of mudflap with gcc / llvm (to detect memory access errors)?

It seems that the -fmudflap function -fmudflap been removed from GCC.

Thus, my question is: what should I use instead for dynamic analysis of programs for extraordinary read / write, uninitialized readings and such problems?

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

The mudflap approach (instrumentation of generated code inside the compiler) looks pretty elegant.

Background

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

A firewall approach may find errors that cannot be detected with valgrind or cleanup (for example, stack-based array access errors). It is also easier than other approaches.

I am looking for an open source solution.

+6
source share
2 answers

It looks like -fsanitize is a direct replacement for -fmudflap . To specify 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).

+7
source

Disinfectants are also slightly more advanced in llvm than in gcc, as the main group contributes to llvm and then someone else passes it to gcc.

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

Is there any information published by the authors in 2012 about disinfectants.

+2
source

Source: https://habr.com/ru/post/958107/


All Articles