c - valgrind asan 运行时不在初始库列表中排在第一位

标签 c gcc valgrind

我使用 GCC 10 标志构建 -fsanitize=address并且可以很好地运行程序,但是如果我在 Valgrind 下运行它,它会显示 Asan 错误:

==477229== Memcheck, a memory error detector
==477229== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==477229== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==477229== Command: ./a.out
==477229== 
==477229==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
==477229== 
==477229== HEAP SUMMARY:
==477229==     in use at exit: 0 bytes in 0 blocks
==477229==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==477229== 
==477229== All heap blocks were freed -- no leaks are possible
==477229== 
==477229== For lists of detected and suppressed errors, rerun with: -s
==477229== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
ldd myprogram
    linux-vdso.so.1 (0x00007ffd0bd90000)
    libasan.so.6 => /lib/x86_64-linux-gnu/libasan.so.6 (0x00007f7256ba6000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f72569b4000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f72569ae000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f725698b000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f725683c000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7256821000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7257599000)
删除 -fsanitize=address , Valgrind 可以很好的运行。那么为什么 sanitizer 会让 Valgrind 错过 Asan 库呢?

最佳答案

至少不久前不支持混合使用 ASan 和 Valgrind,所以看起来它仍然不受支持。
valgrind, gcc 6.2.0 and "-fsanitize=address"对于类似的问题。

关于c - valgrind asan 运行时不在初始库列表中排在第一位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63332739/

相关文章:

memory - 由于 openssl, ARM SIGILL 上的 valgrind

c - 如何在 C 中使用一个引用创建多个内存块

c - 读取大型文本文件并在 C 程序中按字母顺序快速排序

debugging - 如何跟踪重复分配的生命周期堆使用情况

r - 错误 : Could not find build tools necessary to build

c++ - C++ 中的字节翻转数据仅返回零

c - valgrind 给出大小为 1 的无效读取

c - 2个字符串实现的最长公共(public)子串

c - Visual Studio 突然停止工作(链接列表代码)

c++ - 使 MSVC 编译器 GCC 兼容?