解释GDB寄存器(SSE寄存器) [英] Interpreting GDB registers (SSE registers)

查看:127
本文介绍了解释GDB寄存器(SSE寄存器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用GDB 1天了,对此我已经有了相当的了解.但是,当我使用GDB和打印寄存器在最后一个分号处设置断点时,我无法完全解释存储在XMM寄存器中的数据的含义.

I've been using GDB for 1 day and I've accumulated a decent understanding of it. However when I set a breakpoint at the final semicolon using GDB and print registers I can't fully interpret the meaning of the data stored into the XMM register.

我不知道数据是否为(MSB> LSB)格式,反之亦然.

I don't know if the data is in (MSB > LSB) format or vice versa.

    __m128i S = _mm_load_si128((__m128i*)Array16Bytes);

}

这就是我得到的结果.

(gdb) print $xmm0
$1 = {
  v4_float = {1.2593182e-07, -4.1251766e-18, -5.43431603e-31, -2.73406277e-14}, 
  v2_double = {4.6236050467459811e-58, -3.7422963639201271e-245}, 
  v16_int8 = {52, 7, 55, -32, -94, -104, 49, 49, -115, 48, 90, -120, -88, -10, 67, 50}, 
  v8_int16 = {13319, 14304, -23912, 12593, -29392, 23176, -22282, 17202}, 
  v4_int32 = {872888288, -1567084239, -1926210936, -1460255950}, 
  v2_int64 = {3749026652749312305, -8273012972482837710}, 
  uint128 = 0x340737e0a29831318d305a88a8f64332
}

所以有人会指导我如何解释数据.

So would someone kindly guide me how to interpret the data.

推荐答案

SSE(XMM)寄存器可以用各种不同的方式进行解释.寄存器本身不知道隐式数据表示形式,只保存128位数据.XMM寄存器可以表示:

SSE (XMM) registers can be interpreted in various different ways. The register itself has no knowledge of the implicit data representation, it just holds 128 bits of data. An XMM register can represent:

4 x 32 bit floats        __m128
2 x 64 bit doubles       __m128d
16 x 8 bit ints          __m128i
8 x 16 bit ints          __m128i
4 x 32 bit ints          __m128i
2 x 64 bit ints          __m128i
128 individual bits      __m128i

因此,如上例所示,当gdb显示XMM寄存器时,它会为您提供所有可能的解释.

So when gdb displays an XMM register it gives you all possible interpretations, as seen in your example above.

如果要使用特定的解释(例如16 x 8位整数)显示寄存器,则可以这样操作:

If you want to display a register using a specific interpretation (e.g. 16 x 8 bit ints) then you can do it like this:

(gdb) p $xmm0.v16_int8
$1 = {0, 0, 0, 0, 0, 0, 0, 0, -113, -32, 32, -50, 0, 0, 0, 2}

对于字节序,gdb以自然顺序(即从MS到LS从左到右)显示寄存器内容.

As for endianness, gdb displays the register contents in natural order, i.e. left-to-right, from MS to LS.

因此,如果您具有以下代码:

So if you have the following code:

#include <stdio.h>
#include <stdint.h>

#include <xmmintrin.h>
int main(int argc, char *argv[])
{
    int8_t buff[16] __attribute__ ((aligned(16))) = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };

    __m128i v = _mm_load_si128((__m128i *)buff);

    printf("v = %vd\n", v);

    return 0;
}

如果编译并运行它,您将看到:

If you compile and run this you will see:

v = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

但是,如果您逐步浏览gdb中的代码并检查 v ,您将看到:

However if you step through the code in gdb and examine v you will see:

v16_int8 = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}

这篇关于解释GDB寄存器(SSE寄存器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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