无法通过valgrind-3.11运行gcc-5二进制文件

无法通过valgrind-3.11运行gcc-5二进制文件,gcc,valgrind,Gcc,Valgrind,我已经升级到了Ubuntu 16.04.1,它有gcc-5.4和valgrind-3.11 我的代码构建良好,单元测试通过。然而,当我通过valgrind运行测试时,我得到了一个错误 vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1 vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0 vex amd64->IR

我已经升级到了Ubuntu 16.04.1,它有
gcc-5.4
valgrind-3.11

我的代码构建良好,单元测试通过。然而,当我通过valgrind运行测试时,我得到了一个错误

vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==10480== valgrind: Unrecognised instruction at address 0x4ef1b15.
在带有
gcc-4.9.3
valgrind-3.10.1的ubuntu14.04上,它运行良好

在valgrind输出中,它表示:

您的程序刚刚尝试执行Valgrind无法识别的指令

接下来列出了两个可能的原因,一个是我的程序中的错误,另一个是valgrind中的错误

我已经证明我的代码可以在另一个编译器和valgrind版本上运行,所以我的问题是:这是valgrind bug吗?

这是valgrind输出:

==10480== Memcheck, a memory error detector
==10480== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==10480== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==10480== Command: ./dsp/test/dsp_test
==10480== 
Running 9 test cases...
vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==10480== valgrind: Unrecognised instruction at address 0x4ef1b15.
==10480==    at 0x4EF1B15: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==10480==    by 0x4EF1CB1: std::random_device::_M_getval() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==10480==    by 0x602627: std::random_device::operator()() (random.h:1612)
==10480==    by 0x60326C: cay::StatsFixture::StatsFixture() (dsp_tests.cpp:21)
==10480==    by 0x603403: mean_test::mean_test() (dsp_tests.cpp:43)
==10480==    by 0x5F9FEB: mean_test_invoker() (dsp_tests.cpp:43)
==10480==    by 0x60994E: boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) (function_template.hpp:118)
==10480==    by 0x5B4D8C: boost::function0<void>::operator()() const (function_template.hpp:771)
==10480==    by 0x5AB13C: boost::detail::forward::operator()() (execution_monitor.ipp:1306)
==10480==    by 0x5DD424: boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (function_template.hpp:138)
==10480==    by 0x5C8390: boost::function0<int>::operator()() const (function_template.hpp:771)
==10480==    by 0x5B9A76: int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) (execution_monitor.ipp:281)
==10480== Your program just tried to execute an instruction that Valgrind
==10480== did not recognise.  There are two possible reasons for this.
==10480== 1. Your program has a bug and erroneously jumped to a non-code
==10480==    location.  If you are running Memcheck and you just saw a
==10480==    warning about a bad jump, it's probably your program's fault.
==10480== 2. The instruction is legitimate but Valgrind doesn't handle it,
==10480==    i.e. it's Valgrind's fault.  If you think this is the case or
==10480==    you are not sure, please let us know and we'll try to fix it.
==10480== Either way, Valgrind will now raise a SIGILL signal which will
==10480== probably kill your program.
==10480== Warning: client switching stacks?  SP change: 0x5d48008 --> 0xffeffe670
==10480==          to suppress, use: --max-stackframe=68604880488 or greater
unknown location(0): fatal error: in "mean_test": signal: illegal opcode; address of failing instruction: 0x04ef1b15
/home/steve/src/vc/cay/dsp/test/dsp_tests.cpp(43): last checkpoint: "mean_test" fixture entry.
==10480==Memcheck,内存错误检测器
==10480==2002-2015年版权(C)和GNU GPL'd,朱利安·苏厄德等人。
==10480==使用Valgrind-3.11.0和LibVEX;使用-h重新运行以获取版权信息
==10480==命令:./dsp/test/dsp\u test
==10480== 
正在运行9个测试用例。。。
vex amd64->IR:未处理的指令字节:0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1
vex amd64->IR:REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:vex=0 vex.L=0 vex.nVVVV=0x0 ESC=0F
vex amd64->IR:PFX.66=0 PFX.F2=0 PFX.F3=0
==10480==valgrind:地址0x4ef1b15处的指令无法识别。
==10480==0x4EF1B15:???(在/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21中)
==10480==by 0x4EF1CB1:std::random_device::_M_getval()(in/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==10480==by 0x602627:std::random_device::operator()(random.h:1612)
==10480==by 0x60326C:cay::statsixture::statsixture()(dsp_tests.cpp:21)
==10480==by 0x603403:mean_test::mean_test()(dsp_tests.cpp:43)
==10480==by 0x5F9FEB:mean_test_invoker()(dsp_tests.cpp:43)
==10480==0x60994E:boost::detail::function::void_function_invoker0::invoke(boost::detail::function::function_buffer&)(function_template.hpp:118)
==10480==by 0x5B4D8C:boost::function0::operator()()常量(function_template.hpp:771)
==10480==by 0x5AB13C:boost::detail::forward::operator()()(execution_monitor.ipp:1306)
==10480==by 0x5DD424:boost::detail::function\u obj\u invoker0::invoke(boost::detail::function::function\u buffer&)(function\u template.hpp:138)
==10480==by 0x5C8390:boost::function0::operator()()常量(function_template.hpp:771)
==10480==by 0x5B9A76:int boost::detail::do_invoke(boost::shared_ptr const&,boost::function const&)(execution_monitor.ipp:281)
==10480==您的程序刚刚尝试执行一条Valgrind无法执行的指令
==10480==未识别。这可能有两个原因。
==10480== 1. 您的程序有一个bug,并错误地跳转到非代码
==10480==位置。如果您正在运行Memcheck,并且您刚刚看到
==10480==关于错误跳转的警告,可能是程序的错误。
==10480== 2. 指令是合法的但Valgrind不处理,
==10480==也就是说,这是Valgrind的错。如果你认为是这样的话
==10480==您不确定,请让我们知道,我们将尝试修复它。
==10480==无论哪种方式,Valgrind现在将发出一个信号,该信号将
==10480==可能会终止您的程序。
==10480==警告:客户端交换堆栈?SP更改:0x5d48008-->0xFFE670
==10480==要抑制,请使用:--max stackframe=68604880488或更大
未知位置(0):致命错误:在“平均值测试”中:信号:非法操作码;失败指令的地址:0x04ef1b15
/home/steve/src/vc/cay/dsp/test/dsp_tests.cpp(43):最后一个检查点:“平均测试”夹具条目。
这是一个已知的错误

Bug 365325-未处理的指令字节:0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1


我看到了一个类似的问题,但在升级到gcc 8.0.1之后,valgrind 3.11.0也出现了类似问题。