在Windows上使用-faddress-sanitizer进行操作

the*_*oid 12 c c++ windows valgrind clang

我的目的是在Windows上Clang用作替代,以便Valgrind在我编写的C/C++程序中找到缓冲区溢出,动态内存滥用等.我已按照此处提供的说明成功构建了Clang .

我试图编译一个简单的C程序与-faddress-消毒剂选项(如指定位置)及以下的错误被抛出-

gcc.exe: error: unrecognized command line option '-faddress-sanitizer'
Using built-in specs.
COLLECT_GCC=C:/MinGW/bin/gcc.exe
Target: mingw32
Configured with: ../gcc-4.7.0/configure --enable-languages=c,c++,ada,fortran,objc,obj-      c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.0 (GCC)
clang: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

为什么clang(据我所知)调用GCC?当然GCC不支持-faddress-sanitizer选项.

我很高兴有可能使用这个,因为我一直试图找到一个好的(免费)替代Valgrind一段时间.有人可以帮忙吗?

old*_*inb 6

谷歌搜索带我到这个页面.

报价,

支持AddressSanitizer

  • Linux x86_64(在Ubuntu 10.04上测试).
  • MacOS 10.6和10.7(i386/x86_64).

对Linux i386/ARM的支持正在进行中(它可能有效,但也不能保证).


关于替换的话题,你看过记忆博士吗?


tha*_*kis 6

这些天,AddressSanitizer在Windows上运行得更好(但它仍然是一个正在进行中的工作).https://github.com/google/sanitizers/wiki/AddressSanitizerWindowsPort上有一些文档