我的目的是在我编写的C/C++程序中使用Clang作为Valgrind的替代品来查找缓冲区溢出、动态内存滥用等问题。我已经按照here提供的说明成功构建了Clang。
我尝试使用-faddress-sanitizer选项(按照指定的here)编译一个简单的C程序,但抛出了以下错误-
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)为什么clang (据我所知)会引用GCC?当然,GCC不支持-faddress-sanitizer选项。
我真的对使用它的可能性感到兴奋,因为我已经尝试寻找一个好的(免费的) Valgrind的替代品一段时间了。有人能帮帮忙吗?
发布于 2015-01-24 05:09:20
如今,AddressSanitizer在Windows上的表现要好得多(但它还在开发中)。在https://github.com/google/sanitizers/wiki/AddressSanitizerWindowsPort上有一些文档
发布于 2012-08-04 14:38:06
谷歌把我带到了this page。
引用一下,
支持
AddressSanitizer
对Linux i386/ARM的支持正在进行中(它可能会工作,但也不能保证)。
关于替换的话题,你有没有看过Dr. Memory
https://stackoverflow.com/questions/11806469
复制相似问题