Commit 05c5a12f authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Implement proper assignements of floating point numbers.

parent 5f9d09f4
......@@ -397,6 +397,7 @@ extern BOOL memory_fetch_integer(const struct dbg_lvalue* lvalue, un
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 BOOL memory_store_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);
......@@ -497,6 +498,7 @@ extern struct dbg_type types_find_pointer(const struct dbg_type* type);
extern struct dbg_type types_find_type(DWORD64 linear, const char* name, enum SymTagEnum tag);
extern BOOL types_compare(const struct dbg_type, const struct dbg_type, BOOL* equal);
extern BOOL types_is_integral_type(const struct dbg_lvalue*);
extern BOOL types_is_float_type(const struct dbg_lvalue*);
/* winedbg.c */
extern void dbg_outputW(const WCHAR* buffer, int len);
......
......@@ -354,6 +354,23 @@ BOOL memory_fetch_float(const struct dbg_lvalue* lvalue, double *ret)
return TRUE;
}
BOOL memory_store_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 (size == sizeof(float))
{
float f = *ret;
return memory_write_value(lvalue, size, &f);
}
if (size != sizeof(double)) return FALSE;
return memory_write_value(lvalue, size, ret);
}
BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee,
BOOL unicode, char* buffer, int size)
{
......
......@@ -168,6 +168,12 @@ BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lv
if (!types_compare(lvalue_to->type, lvalue_from->type, &equal)) return FALSE;
if (equal)
return memory_transfer_value(lvalue_to, lvalue_from);
if (types_is_float_type(lvalue_from) && types_is_float_type(lvalue_to))
{
double d;
return memory_fetch_float(lvalue_from, &d) &&
memory_store_float(lvalue_to, &d);
}
}
if (types_is_integral_type(lvalue_from) && types_is_integral_type(lvalue_to))
{
......@@ -175,7 +181,6 @@ BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lv
dbg_lgint_t val = types_extract_as_integer(lvalue_from);
return memory_store_integer(lvalue_to, val);
}
/* FIXME: should support floats as well */
dbg_printf("Cannot assign (different types)\n"); return FALSE;
return FALSE;
}
......@@ -1075,3 +1080,13 @@ BOOL types_is_integral_type(const struct dbg_lvalue* lv)
!types_get_info(&type, TI_GET_BASETYPE, &bt)) return FALSE;
return is_basetype_integer(bt);
}
BOOL types_is_float_type(const struct dbg_lvalue* lv)
{
struct dbg_type type = lv->type;
DWORD tag, bt;
if (lv->bitlen) return FALSE;
if (!types_get_real_type(&type, &tag) ||
!types_get_info(&type, TI_GET_BASETYPE, &bt)) return FALSE;
return bt == btFloat;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment