valgrind,gcc 6.2.0和“ -fsanitize = address” [英] valgrind, gcc 6.2.0 and "-fsanitize=address"

查看:120
本文介绍了valgrind,gcc 6.2.0和“ -fsanitize = address”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,当使用'-fsanitize = address'进行编译时,当运行带有valgrind
的应用程序时,我得到
一个执行异常

Recently, when compiling with '-fsanitize=address' I am getting an execution exception when running an application with valgrind namely

ASan运行时不在初始库列表中排在第一位。

"ASan runtime does not come first in initial library list"

我对valgrind的实际用途一无所知。
'ldd file.exe'命令提供

I am a little clueless what valgrind actually does. The command 'ldd file.exe' delivers

    linux-gate.so.1 =>  (0xb7755000)
    libasan.so.3 => /usr/lib/i386-linux-gnu/libasan.so.3 (0xb7199000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6fdf000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6fd8000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb6fcf000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6fb2000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6f5c000)
    /lib/ld-linux.so.2 (0x80092000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6f3e000)

有任何提示吗?

推荐答案

您将无法在Valgrind下运行经过清理的代码。即使您克服了预加载libasan的问题,也会遇到冲突的地址空间要求(即,在启动时Valgrind保留了Asan影子内存所需的内存区域),并且这两个地址都无法解决。在Valgrind和libasan中进行硬编码。 Asan和Tsan或Asan和Msan也存在类似的问题(即无法同时启用它们)。由于消毒剂高度专业化以实现其令人印象深刻的性能数据,因此不太可能修复。

You won't be able to run sanitized code under Valgrind. Even if you get past the problem with preloading libasan, you'll run into conflicting address space requirements (i.e. upon start Valgrind reserves region of memory which is also required by Asan shadow memory) and this can't be worked around as both addresses are hard-coded in Valgrind and libasan. Similar issues exist for Asan and Tsan or Asan and Msan (i.e. they can't be enabled simultaneously). It's unlikely to be fixed as sanitizers are highly specialized to achieve their impressive performance numbers.

这篇关于valgrind,gcc 6.2.0和“ -fsanitize = address”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆