valgrind:破坏crypto++zlib测试

valgrind: Disrupting crypto++ zlib test

本文关键字:测试 crypto++zlib 破坏 valgrind      更新时间:2023-10-16

我在一个使用Crypto++的zlib函数的程序上遇到了一个奇怪的valgrind错误:

vex x86->IR: unhandled instruction bytes: 0xC5 0xF9 0x6E 0x45
==8605== valgrind: Unrecognised instruction at address 0x814c88b.
==8605==    at 0x814C88B: CryptoPP::ByteQueue::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long long&, std::string const&, bool) (misc.h:189)
==8605==    by 0x814C3E6: CryptoPP::ByteQueue::Get(unsigned char*, unsigned int) (cryptlib.h:901)
==8605==    by 0x815DAAE: CryptoPP::ZlibDecompressor::ProcessPoststreamTail() (zlib.cpp:84)
==8605==    by 0x815B6EC: CryptoPP::Inflator::ProcessInput(bool) (zinflate.cpp:349)
==8605==    by 0x815BC25: CryptoPP::Inflator::Put2(unsigned char const*, unsigned int, int, bool) (zinflate.cpp:295)
==8605==    by 0x805E40C: CryptoPP::BufferedTransformation::Put(unsigned char const*, unsigned int, bool) (cryptlib.h:789)

我知道Crypto++在某些领域使用一些手工编码的汇编来加快速度,我读过以0xC5开头的指令从未出现在编译的代码中。这可能是由于一块手工编码的程序集发出的程序集指令吗?如果是,我可以通过valgrind禁用此检查,以便继续测试我的程序吗?

这是一条AVX指令。Valgrind目前不支持AVX指令,但AVX支持正在开发中。因为valgrind是通过模拟每个指令来工作的,所以它不仅仅是一个检查,除非你想让它直接跳到实际指令,否则你可以绕过它,这将在剩余的执行过程中完全禁用valgrind。