Print value of __m128 datatype in gdb debugger

c++, gdb, intrinsics, simd, sse

Solution

It's a pain, but I usually do it like this:

`gdb> p *(float *)&v@4`

This is assuming that `v` is `__m128`. You can apply the same principle for e.g. an `__m128i` vector of `unsigned char`:

`gdb> p /x *(unsigned char *)&v@16`

Problem

Is there any way to print the value of a variable of datatype `__m128` (used for Intel SSE intrinsics) directly in GDB? The command `print $myVariable` works fine for `int` and `float` but not for `__m128`.

Original source