Module: wine Branch: master Commit: 13125b51cdf7ba8e8d658dcf35b8f32d40447619 URL: https://source.winehq.org/git/wine.git/?a=commit;h=13125b51cdf7ba8e8d658dcf3...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Oct 4 15:00:20 2021 +0200
winedbg: Avoid using the 'long double' type.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/winedbg/be_arm.c | 6 ++---- programs/winedbg/be_arm64.c | 6 ++---- programs/winedbg/be_cpu.h | 2 +- programs/winedbg/be_i386.c | 26 +++++++++----------------- programs/winedbg/be_x86_64.c | 31 +++++++++---------------------- programs/winedbg/memory.c | 4 ++-- 6 files changed, 25 insertions(+), 50 deletions(-)
diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c index 98078e22640..fa25ce8dd2b 100644 --- a/programs/winedbg/be_arm.c +++ b/programs/winedbg/be_arm.c @@ -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; diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c index 50bb5bad0b9..d22f254013b 100644 --- a/programs/winedbg/be_arm64.c +++ b/programs/winedbg/be_arm64.c @@ -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; diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h index 354a6252d39..14746d6665b 100644 --- a/programs/winedbg/be_cpu.h +++ b/programs/winedbg/be_cpu.h @@ -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);
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c index 76f9b8f807b..08d0841a208 100644 --- a/programs/winedbg/be_i386.c +++ b/programs/winedbg/be_i386.c @@ -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++) - { - 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++) + for (cnt = 0; 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; diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index 7b6d94deb59..74481645081 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -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++) - { - dbg_printf(" st%u:%-16Lg ", i, m128a_to_longdouble(ctx->u.FltSave.FloatRegisters[i])); - } - dbg_printf("\n"); - for (i = 4; i < 8; i++) + for (i = 0; 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; diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index ed537e121a9..ab8b2eb49b8 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -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: