Do you have an idea on how to display the contents of the xmm registers in a better way?Meaning of content of XMM registers is not fixed. In other words, citing "IA-32 Intel Architecture Software Developer's Manual; Volume 1, Basic Architecture", section 11.6.9:
SSE and SSE2 extensions define typed operations on packed and scalar floating-point data types(italisized by me)
and on 128-bit SIMD integer data types, but IA-32 processors do not enforce this typing at the
architectural level. They only enforce it at the microarchitectural level. Therefore, when a
Pentium 4 or Intel Xeon processor loads a packed or scalar floating-point operand or a 128-bit
packed integer operand from memory into an XMM register, it does not check that the actual
data being loaded matches the data type specified in the instruction. Likewise, when the
processor performs an arithmetic operation on the data in an XMM register, it does not check
that the data being operated on matches the data type specified in the instruction.
As a general rule, because data typing of SIMD floating-point and integer data types is not
enforced at the architectural level, it is the responsibility of the programmer, assembler, or
compiler to insure that code enforces data typing.
The ability to operate on an operand that contains a data type that is inconsistent with the typing
of the instruction being executed, permits some valid operations to be performed. For example,
the following instructions load a packed double-precision floating-point operand from memory
to register XMM0, and a mask to register XMM1; then they use XORPD to toggle the sign bits
of the two packed values in register XMM0.
movapdxmm0, [eax] ; EAX register contains pointer to packed
; double-precision floating-point operand
movapsxmm1, [ebx] ; EBX register contains pointer to packed
; double-precision floating-point mask
xorpdxmm0, xmm1 ; XOR operation toggles sign bits using
; the mask in xmm1
To make matters worse, the register set and what can be in which register also depends on your CPU (MMX/SSE/SSE2/SSE3).
<edit>Forgot to mention another problem: Since the MMX registers and the floating point registers are indeed the the same physical set of registers, you have yet another thing which you have to guess to display it right.</edit>
When an MMX instruction (other than the EMMS instruction) is executed, the processor
changes the x87 FPU state as follows:
- The TOS (top of stack) value of the x87 FPU status word is set to 0.
- The entire x87 FPU tag word is set to the valid state (00B in all tag fields).
- When an MMX instruction writes to an MMX register, it writes ones (11B) to the exponent part of the corresponding floating-point register (bits 64 through 79).
In Xcode (which also wraps GBD) they give the option of opening up a console to the debugger, it would be cool if you could do the same in codeblocks. Perhaps changing the debugger messages window, to a debugger console.
int main (void)can be compiled by:
{
asm(".intel_syntax noprefix\n");
asm("mov edx,5\n");
}
gcc -masm=intel main.cpp -o intel_asm_sample
I'm trying to add this feature to the debugger plug-in.Nice work so far! :D
src/plugins/debuggergdb/cpuregistersdlg.cpp
src/plugins/debuggergdb/cpuregistersdlg.h
src/plugins/debuggergdb/cdb_commands.h
src/plugins/debuggergdb/gdb_commands.h