winedbg: Avoid using the 'long double' type.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-10-04 15:00:20 +02:00
parent b9046a4936
commit 13125b51cd
6 changed files with 25 additions and 50 deletions

View File

@ -1851,10 +1851,9 @@ static BOOL be_arm_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
return TRUE;
}
static BOOL be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
long double* ret)
static BOOL be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(long double)];
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
@ -1863,7 +1862,6 @@ static BOOL be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else if (size == sizeof(long double)) *ret = *(long double*)tmp;
else return FALSE;
return TRUE;

View File

@ -248,10 +248,9 @@ static BOOL be_arm64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned siz
return TRUE;
}
static BOOL be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
long double* ret)
static BOOL be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(long double)];
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
@ -260,7 +259,6 @@ static BOOL be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else if (size == sizeof(long double)) *ret = *(long double*)tmp;
else return FALSE;
return TRUE;

View File

@ -121,7 +121,7 @@ struct backend_cpu
/* Reads an integer from memory and stores it inside a long long int */
BOOL (*fetch_integer)(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG*);
/* Reads a real from memory and stores it inside a long double */
BOOL (*fetch_float)(const struct dbg_lvalue* lvalue, unsigned size, long double*);
BOOL (*fetch_float)(const struct dbg_lvalue* lvalue, unsigned size, double*);
/* Writes an integer to memory */
BOOL (*store_integer)(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG);

View File

@ -133,7 +133,6 @@ static void be_i386_all_print_context(HANDLE hThread, const dbg_ctx_t *pctx)
"DM", "ZM", "OM", "UM", "PM", "R-", "R+", "FZ" };
const WOW64_CONTEXT *ctx = &pctx->x86;
XSAVE_FORMAT *xmm_area;
long double ST[8]; /* These are for floating regs */
int cnt;
/* Break out the FPU state and the floating point registers */
@ -185,16 +184,12 @@ static void be_i386_all_print_context(HANDLE hThread, const dbg_ctx_t *pctx)
/* Now for the floating point registers */
dbg_printf("Floating Point Registers:\n");
for (cnt = 0; cnt < 4; cnt++)
for (cnt = 0; cnt < 8; cnt++)
{
memcpy(&ST[cnt], &ctx->FloatSave.RegisterArea[cnt * 10], 10);
dbg_printf(" ST%d:%Lf ", cnt, ST[cnt]);
}
dbg_printf("\n");
for (cnt = 4; cnt < 8; cnt++)
{
memcpy(&ST[cnt], &ctx->FloatSave.RegisterArea[cnt * 10], 10);
dbg_printf(" ST%d:%Lf ", cnt, ST[cnt]);
const BYTE *p = &ctx->FloatSave.RegisterArea[cnt * 10];
if (cnt == 4) dbg_printf("\n");
dbg_printf(" ST%d:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x ", cnt,
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9] );
}
xmm_area = (XSAVE_FORMAT *) &ctx->ExtendedRegisters;
@ -802,20 +797,17 @@ static BOOL be_i386_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size
return TRUE;
}
static BOOL be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
long double* ret)
static BOOL be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(long double)];
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
*/
if (!memory_read_value(lvalue, size, tmp)) return FALSE;
/* float & double types have to be promoted to a long double */
if (size == 4) *ret = *(float*)tmp;
else if (size == 8) *ret = *(double*)tmp;
else if (size == 10) *ret = *(long double*)tmp;
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else return FALSE;
return TRUE;

View File

@ -73,14 +73,6 @@ static void be_x86_64_single_step(dbg_ctx_t *ctx, BOOL enable)
else ctx->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 dbg_ctx_t *pctx,
int all_regs)
{
@ -154,14 +146,12 @@ static void be_x86_64_print_context(HANDLE hThread, const dbg_ctx_t *pctx,
ctx->u.FltSave.ErrorSelector, ctx->u.FltSave.ErrorOffset,
ctx->u.FltSave.DataSelector, ctx->u.FltSave.DataOffset );
for (i = 0; i < 4; i++)
for (i = 0; i < 8; i++)
{
dbg_printf(" st%u:%-16Lg ", i, m128a_to_longdouble(ctx->u.FltSave.FloatRegisters[i]));
}
dbg_printf("\n");
for (i = 4; i < 8; i++)
{
dbg_printf(" st%u:%-16Lg ", i, m128a_to_longdouble(ctx->u.FltSave.FloatRegisters[i]));
M128A reg = ctx->u.FltSave.FloatRegisters[i];
if (i == 4) dbg_printf("\n");
dbg_printf(" ST%u:%08x%08x%08x%08x ", i,
(DWORD)(reg.High >> 32), (DWORD)reg.High, (DWORD)(reg.Low >> 32), (DWORD)reg.Low );
}
dbg_printf("\n");
@ -731,20 +721,17 @@ static BOOL be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned si
return TRUE;
}
static BOOL be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
long double* ret)
static BOOL be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(long double)];
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
*/
if (!memory_read_value(lvalue, size, tmp)) return FALSE;
/* float & double types have to be promoted to a long double */
if (size == 4) *ret = *(float*)tmp;
else if (size == 8) *ret = *(double*)tmp;
else if (size == 10) *ret = *(long double*)tmp;
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else return FALSE;
return TRUE;

View File

@ -350,7 +350,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
{
LONGLONG val_int;
void* val_ptr;
long double val_real;
double val_real;
DWORD64 size64;
DWORD tag, size, count, bt;
struct dbg_type type = lvalue->type;
@ -385,7 +385,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
break;
case btFloat:
if (!dbg_curr_process->be_cpu->fetch_float(lvalue, size, &val_real)) return;
dbg_printf("%Lf", val_real);
dbg_printf("%f", val_real);
break;
case btChar:
case btWChar: