Valgrind无法识别的指令 [英] Valgrind Unrecognised instruction

查看:657
本文介绍了Valgrind无法识别的指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

#include <iostream>
#include <random>

int main() {
    std::mt19937_64 rng(std::random_device{}());
    std::cout << std::uniform_int_distribution<>(0, 100)(rng) << '\n';
}

我尝试使用valgrind对其进行分析,但是它说:

I try to profile it using valgrind, but it says:

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
==2092== valgrind: Unrecognised instruction at address 0x4cdc1b5.  
==2092== at 0x4CDC1B5:std::(anonymous namespace)::__x86_rdrand() (random.cc:69)  
==2092== by 0x4CDC321: std::random_device::_M_getval() (random.cc:130)  
==2092== by 0x4009D4: main (random.h:1619)  

在以下多个实例之前

--2092-- WARNING: Serious error when reading debug info  
--2092-- When reading debug info from /lib/x86_64-linux-gnu/ld-2.22.so:  
--2092-- Ignoring non-Dwarf2/3/4 block in .debug_info  

我在Debian上使用x86-64平台上的标准软件包,并使用valgrind-3.11.0在gcc 5.3.1上进行编译.非法指令似乎在libstdc ++ 6内部.

I am on Debian using standard packages on an x86-64 platform compiling with gcc 5.3.1 using valgrind-3.11.0. The illegal instruction seems to be inside libstdc++6.

如何获取valgrind配置文件代码?

How do I get valgrind to profile my code?

推荐答案

实际上,Valgrind用中间语言(VEX)模拟您的程序,以了解是否发现内存冲突.

In fact, Valgrind emulate your program with an intermediate language (VEX) to know if it discovers memory violation.

这种VEX语言捕获了多个汇编程序的所有指令,例如i386,amd64,arm等.但是,它有时会错过一些指令(尤其是专门的指令,例如

This VEX language capture all the instructions of several assemblers such as i386, amd64, arm, ... But, from time to time, it miss a few instructions (especially specialized ones like rdrand which is linked to the AES specific instructions set).

好吧,这正是您的程序所发生的事情. Valgrind可能确实偶然发现了一条未知的指令,因此无法将其翻译成VEX中间语言.

Well, this is exactly what happened with your program. Valgrind did probably stumbled on an unknown instruction and could not translate it into the VEX intermediate language.

但是,您并不是唯一一个排队等待修复的人:

But, you are not the only one to be in line waiting for a fix:

  • Same issue on Launchpad.
  • Same issue on KDE bugtracker.
  • ... and so on ...

这是一个已应用于Valgrind的补丁,并且可能 >为您解决问题(取决于您的CPU).

Here is a patch that has been applied to Valgrind and that may solve the problem for you (depending on your CPU).

但是,您唯一能做的就是安装较新版本的Valgrind,并希望最新版本支持该说明.

But, the only thing you can do is to install a newer version of Valgrind and hope that the instruction is supported in the newest version.

这篇关于Valgrind无法识别的指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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