目前在 Windows 上的 Ubuntu Bash 上运行 llvm、clang、clang-format 和 clang-modernize。我想使用谷歌发布的一套清理工具,包括地址、内存和线程清理。 fsanitize 选项似乎都不起作用。
以下是 ASAN 的代码示例:
#include <stdlib.h>
int main() {
char *x = (char *)malloc(10 * sizeof(char *));
free(x);
return x[5];// purposely accessing deallocated memory
}
这是 Windows 上 bash 中的 clang 调用:
$clang++-3.5 -fsanitize=address -o1 -fno-omit-frame-pointer -g main.cpp -o main
$./main
Results
==70==Sanitizer CHECK failed: build/buildd/llvm-toolchain-snapshot-3.5/projects/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc:211 ((IsOneOf(*current_, 's', 'p'))) != (0)(0,0)
我希望得到关于如何让它工作或者我是否缺少工具链的一部分或其他东西的建议。
如果做不到这一点,我想我将双启动 Ubuntu 或 Debian,因为 Windows 的 clang 缺少 std:out 支持等简单功能,尽管理想情况下我希望能够为 Windows 目标和 Linux 目标进行编译。我想避免双启动,因为 Ubuntu 无法挂载 Windows 存储空间,但它们似乎可以很好地服务于 Windows 上的 Ubuntu bash。
快速浏览一下源代码 - MemoryMappingLayout::Next -https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_linux.cc- 问题似乎是 Windows 上 ubuntu 上的 bash 对 /proc 文件系统的支持不完整。
失败的代码正在查看 /proc/self/maps - 实际上 - 似乎是正确的。
但是我发现 /proc 中的其他东西(例如网络)在 bashonwindowsonunix 上完全损坏了 - 所以我很确定这部分是正在进行中的工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)