winedbg: Remove fetch_float() method from CPU backends.

As they're all the same.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-12-08 14:44:38 +01:00 committed by Alexandre Julliard
parent 0ed8cac2cd
commit 5f9d09f4bd
7 changed files with 17 additions and 76 deletions

View File

@ -1831,23 +1831,6 @@ static int be_arm_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way)
return step;
}
static BOOL be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
*/
if (size > sizeof(tmp)) return FALSE;
if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else return FALSE;
return TRUE;
}
static BOOL be_arm_get_context(HANDLE thread, dbg_ctx_t *ctx)
{
ctx->ctx.ContextFlags = CONTEXT_ALL;
@ -1904,7 +1887,6 @@ struct backend_cpu be_arm =
be_arm_is_watchpoint_set,
be_arm_clear_watchpoint,
be_arm_adjust_pc_for_break,
be_arm_fetch_float,
be_arm_get_context,
be_arm_set_context,
be_arm_gdb_register_map,

View File

@ -228,23 +228,6 @@ static int be_arm64_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way)
return 4;
}
static BOOL be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
*/
if (size > sizeof(tmp)) return FALSE;
if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else return FALSE;
return TRUE;
}
void be_arm64_disasm_one_insn(ADDRESS64 *addr, int display)
{
dbg_printf("be_arm64_disasm_one_insn: not done\n");
@ -323,7 +306,6 @@ struct backend_cpu be_arm64 =
be_arm64_is_watchpoint_set,
be_arm64_clear_watchpoint,
be_arm64_adjust_pc_for_break,
be_arm64_fetch_float,
be_arm64_get_context,
be_arm64_set_context,
be_arm64_gdb_register_map,

View File

@ -118,9 +118,6 @@ struct backend_cpu
/* -------------------------------------------------------------------------------
* basic type read/write
* -------------------------------------------------------------------------------*/
/* Reads a real from memory and stores it inside a long double */
BOOL (*fetch_float)(const struct dbg_lvalue* lvalue, unsigned size, double*);
BOOL (*get_context)(HANDLE thread, dbg_ctx_t *ctx);
BOOL (*set_context)(HANDLE thread, const dbg_ctx_t *ctx);

View File

@ -777,23 +777,6 @@ static int be_i386_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way)
return 1;
}
static BOOL be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
*/
if (size > sizeof(tmp)) return FALSE;
if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else return FALSE;
return TRUE;
}
static BOOL be_i386_get_context(HANDLE thread, dbg_ctx_t *ctx)
{
ctx->x86.ContextFlags = WOW64_CONTEXT_ALL;
@ -875,7 +858,6 @@ struct backend_cpu be_i386 =
be_i386_is_watchpoint_set,
be_i386_clear_watchpoint,
be_i386_adjust_pc_for_break,
be_i386_fetch_float,
be_i386_get_context,
be_i386_set_context,
be_i386_gdb_register_map,

View File

@ -699,23 +699,6 @@ static int be_x86_64_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way)
return 1;
}
static BOOL be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, double *ret)
{
char tmp[sizeof(double)];
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
*/
if (size > sizeof(tmp)) return FALSE;
if (!memory_read_value(lvalue, size, tmp)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)tmp;
else if (size == sizeof(double)) *ret = *(double*)tmp;
else return FALSE;
return TRUE;
}
static BOOL be_x86_64_get_context(HANDLE thread, dbg_ctx_t *ctx)
{
ctx->ctx.ContextFlags = CONTEXT_ALL;
@ -813,7 +796,6 @@ struct backend_cpu be_x86_64 =
be_x86_64_is_watchpoint_set,
be_x86_64_clear_watchpoint,
be_x86_64_adjust_pc_for_break,
be_x86_64_fetch_float,
be_x86_64_get_context,
be_x86_64_set_context,
be_x86_64_gdb_register_map,

View File

@ -396,6 +396,7 @@ extern BOOL memory_transfer_value(const struct dbg_lvalue* to, const
extern BOOL memory_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
BOOL is_signed, dbg_lgint_t* ret);
extern BOOL memory_store_integer(const struct dbg_lvalue* lvalue, dbg_lgint_t val);
extern BOOL memory_fetch_float(const struct dbg_lvalue* lvalue, double *ret);
extern void memory_examine(const struct dbg_lvalue *lvalue, int count, char format);
extern void* memory_to_linear_addr(const ADDRESS64* address);
extern BOOL memory_get_current_pc(ADDRESS64* address);

View File

@ -338,6 +338,21 @@ BOOL memory_store_integer(const struct dbg_lvalue* lvalue, dbg_lgint_t val)
return memory_write_value(lvalue, (unsigned)size, &val);
}
BOOL memory_fetch_float(const struct dbg_lvalue* lvalue, double *ret)
{
DWORD64 size;
if (!types_get_info(&lvalue->type, TI_GET_LENGTH, &size)) return FALSE;
/* FIXME: this assumes that debuggee and debugger use the same
* representation for reals
*/
if (size > sizeof(*ret)) return FALSE;
if (!memory_read_value(lvalue, size, ret)) return FALSE;
if (size == sizeof(float)) *ret = *(float*)ret;
else if (size != sizeof(double)) return FALSE;
return TRUE;
}
BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee,
BOOL unicode, char* buffer, int size)
@ -478,7 +493,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
dbg_print_hex(size, val_int);
break;
case btFloat:
if (!dbg_curr_process->be_cpu->fetch_float(lvalue, size, &val_real)) return;
if (!memory_fetch_float(lvalue, &val_real)) return;
dbg_printf("%f", val_real);
break;
case btChar: