winedbg: Fix printing of fp registers for x86_64 CPU.

oldstable
Eric Pouech 2012-05-08 19:52:34 +02:00 committed by Alexandre Julliard
parent 1f3d99a2e4
commit 721a3c910a
1 changed files with 10 additions and 6 deletions

View File

@ -70,6 +70,14 @@ static void be_x86_64_single_step(CONTEXT* ctx, unsigned enable)
else ctx->EFlags &= ~STEP_FLAG; else ctx->EFlags &= ~STEP_FLAG;
} }
static inline long double m128a_to_longdouble(const M128A m)
{
/* gcc uses the same IEEE-754 representation as M128A for long double
* but 16 byte aligned (hence only the first 10 bytes out of the 16 are used)
*/
return *(long double*)&m;
}
static void be_x86_64_print_context(HANDLE hThread, const CONTEXT* ctx, static void be_x86_64_print_context(HANDLE hThread, const CONTEXT* ctx,
int all_regs) int all_regs)
{ {
@ -144,16 +152,12 @@ static void be_x86_64_print_context(HANDLE hThread, const CONTEXT* ctx,
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
long double st; dbg_printf(" st%u:%-16Lg ", i, m128a_to_longdouble(ctx->u.FltSave.FloatRegisters[i]));
memcpy(&st, &ctx->u.FltSave.FloatRegisters[i * 10], 10);
dbg_printf(" st%u:%-16Lg ", i, st);
} }
dbg_printf("\n"); dbg_printf("\n");
for (i = 4; i < 8; i++) for (i = 4; i < 8; i++)
{ {
long double st; dbg_printf(" st%u:%-16Lg ", i, m128a_to_longdouble(ctx->u.FltSave.FloatRegisters[i]));
memcpy(&st, &ctx->u.FltSave.FloatRegisters[i * 10], 10);
dbg_printf(" st%u:%-16Lg ", i, st);
} }
dbg_printf("\n"); dbg_printf("\n");