winedbg: Fix set instruction when sizeof(int) <> sizeof register.
This commit is contained in:
parent
13f483a2a2
commit
88949b2c59
|
@ -255,6 +255,13 @@ static int be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static int be_arm_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
|
||||
unsigned is_signed, LONGLONG val)
|
||||
{
|
||||
dbg_printf("be_arm_store_integer: not done\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct backend_cpu be_arm =
|
||||
{
|
||||
IMAGE_FILE_MACHINE_ARMV7,
|
||||
|
@ -280,5 +287,6 @@ struct backend_cpu be_arm =
|
|||
be_arm_adjust_pc_for_break,
|
||||
be_arm_fetch_integer,
|
||||
be_arm_fetch_float,
|
||||
be_arm_store_integer,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -112,6 +112,8 @@ struct backend_cpu
|
|||
int (*fetch_integer)(const struct dbg_lvalue* lvalue, unsigned size, unsigned is_signed, LONGLONG*);
|
||||
/* Reads a real from memory and stores it inside a long double */
|
||||
int (*fetch_float)(const struct dbg_lvalue* lvalue, unsigned size, long double*);
|
||||
/* Writes an integer to memory */
|
||||
int (*store_integer)(const struct dbg_lvalue* lvalue, unsigned size, unsigned is_signed, LONGLONG);
|
||||
};
|
||||
|
||||
extern struct backend_cpu* be_cpu;
|
||||
|
|
|
@ -772,6 +772,13 @@ static int be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static int be_i386_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
|
||||
unsigned is_signed, LONGLONG val)
|
||||
{
|
||||
/* this is simple as we're on a little endian CPU */
|
||||
return memory_write_value(lvalue, size, &val);
|
||||
}
|
||||
|
||||
struct backend_cpu be_i386 =
|
||||
{
|
||||
IMAGE_FILE_MACHINE_I386,
|
||||
|
@ -797,5 +804,6 @@ struct backend_cpu be_i386 =
|
|||
be_i386_adjust_pc_for_break,
|
||||
be_i386_fetch_integer,
|
||||
be_i386_fetch_float,
|
||||
be_i386_store_integer,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -173,6 +173,13 @@ static int be_ppc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static int be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
|
||||
unsigned is_signed, LONGLONG val)
|
||||
{
|
||||
dbg_printf("be_ppc_store_integer: not done\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct backend_cpu be_ppc =
|
||||
{
|
||||
IMAGE_FILE_MACHINE_POWERPC,
|
||||
|
@ -198,5 +205,6 @@ struct backend_cpu be_ppc =
|
|||
be_ppc_adjust_pc_for_break,
|
||||
be_ppc_fetch_integer,
|
||||
be_ppc_fetch_float,
|
||||
be_ppc_store_integer,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -148,6 +148,13 @@ static int be_sparc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static int be_sparc_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
|
||||
unsigned is_signed, LONGLONG val)
|
||||
{
|
||||
dbg_printf("be_sparc_store_integer: not done\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct backend_cpu be_sparc =
|
||||
{
|
||||
IMAGE_FILE_MACHINE_SPARC,
|
||||
|
@ -173,5 +180,6 @@ struct backend_cpu be_sparc =
|
|||
be_sparc_adjust_pc_for_break,
|
||||
be_sparc_fetch_integer,
|
||||
be_sparc_fetch_float,
|
||||
be_sparc_store_integer,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -638,6 +638,13 @@ static int be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static int be_x86_64_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
|
||||
unsigned is_signed, LONGLONG val)
|
||||
{
|
||||
/* this is simple as we're on a little endian CPU */
|
||||
return memory_write_value(lvalue, size, &val);
|
||||
}
|
||||
|
||||
struct backend_cpu be_x86_64 =
|
||||
{
|
||||
IMAGE_FILE_MACHINE_AMD64,
|
||||
|
@ -663,5 +670,6 @@ struct backend_cpu be_x86_64 =
|
|||
be_x86_64_adjust_pc_for_break,
|
||||
be_x86_64_fetch_integer,
|
||||
be_x86_64_fetch_float,
|
||||
be_x86_64_store_integer,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -204,7 +204,7 @@ disassemble_command:
|
|||
;
|
||||
|
||||
set_command:
|
||||
tSET lvalue_addr '=' expr_rvalue { memory_write_value(&$2, sizeof(int), &$4); }
|
||||
tSET lvalue_addr '=' expr_lvalue { types_store_value(&$2, &$4); }
|
||||
| tSET '+' tIDENTIFIER { info_wine_dbg_channel(TRUE, NULL, $3); }
|
||||
| tSET '+' tALL { info_wine_dbg_channel(TRUE, NULL, "all"); }
|
||||
| tSET '-' tIDENTIFIER { info_wine_dbg_channel(FALSE, NULL, $3); }
|
||||
|
|
|
@ -437,8 +437,9 @@ extern void print_value(const struct dbg_lvalue* addr, char format,
|
|||
extern int types_print_type(const struct dbg_type*, BOOL details);
|
||||
extern int print_types(void);
|
||||
extern long int types_extract_as_integer(const struct dbg_lvalue*);
|
||||
extern LONGLONG types_extract_as_longlong(const struct dbg_lvalue*, unsigned* psize);
|
||||
extern LONGLONG types_extract_as_longlong(const struct dbg_lvalue*, unsigned* psize, BOOL *pissigned);
|
||||
extern void types_extract_as_address(const struct dbg_lvalue*, ADDRESS64*);
|
||||
extern BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lvalue_from);
|
||||
extern BOOL types_udt_find_element(struct dbg_lvalue* value, const char* name, long int* tmpbuf);
|
||||
extern BOOL types_array_index(const struct dbg_lvalue* value, int index, struct dbg_lvalue* result);
|
||||
extern BOOL types_get_info(const struct dbg_type*, IMAGEHLP_SYMBOL_TYPE_INFO, void*);
|
||||
|
|
|
@ -524,7 +524,7 @@ void print_basic(const struct dbg_lvalue* lvalue, char format)
|
|||
if (format != 0)
|
||||
{
|
||||
unsigned size;
|
||||
LONGLONG res = types_extract_as_longlong(lvalue, &size);
|
||||
LONGLONG res = types_extract_as_longlong(lvalue, &size, NULL);
|
||||
WCHAR wch;
|
||||
|
||||
switch (format)
|
||||
|
@ -557,7 +557,7 @@ void print_basic(const struct dbg_lvalue* lvalue, char format)
|
|||
}
|
||||
if (lvalue->type.id == dbg_itype_segptr)
|
||||
{
|
||||
dbg_print_longlong(types_extract_as_longlong(lvalue, NULL), TRUE);
|
||||
dbg_print_longlong(types_extract_as_longlong(lvalue, NULL, NULL), TRUE);
|
||||
}
|
||||
else print_typed_basic(lvalue);
|
||||
}
|
||||
|
|
|
@ -53,12 +53,14 @@ BOOL types_get_real_type(struct dbg_type* type, DWORD* tag)
|
|||
* Given a lvalue, try to get an integral (or pointer/address) value
|
||||
* out of it
|
||||
*/
|
||||
LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, unsigned* psize)
|
||||
LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue,
|
||||
unsigned* psize, BOOL *issigned)
|
||||
{
|
||||
LONGLONG rtn;
|
||||
DWORD tag, bt;
|
||||
DWORD64 size;
|
||||
struct dbg_type type = lvalue->type;
|
||||
BOOL s = FALSE;
|
||||
|
||||
if (!types_get_real_type(&type, &tag))
|
||||
RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
|
||||
|
@ -69,6 +71,7 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, unsigned* ps
|
|||
}
|
||||
|
||||
if (psize) *psize = 0;
|
||||
if (issigned) *issigned = FALSE;
|
||||
switch (tag)
|
||||
{
|
||||
case SymTagBaseType:
|
||||
|
@ -87,30 +90,31 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, unsigned* ps
|
|||
{
|
||||
case btChar:
|
||||
case btInt:
|
||||
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, TRUE, &rtn))
|
||||
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, s = TRUE, &rtn))
|
||||
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
|
||||
break;
|
||||
case btUInt:
|
||||
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, FALSE, &rtn))
|
||||
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, s = FALSE, &rtn))
|
||||
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
|
||||
break;
|
||||
case btFloat:
|
||||
RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
|
||||
}
|
||||
if (psize) *psize = (unsigned)size;
|
||||
if (issigned) *issigned = s;
|
||||
break;
|
||||
case SymTagPointerType:
|
||||
if (!be_cpu->fetch_integer(lvalue, sizeof(void*), FALSE, &rtn))
|
||||
if (!be_cpu->fetch_integer(lvalue, sizeof(void*), s = FALSE, &rtn))
|
||||
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
|
||||
break;
|
||||
case SymTagArrayType:
|
||||
case SymTagUDT:
|
||||
if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), FALSE, &rtn))
|
||||
if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn))
|
||||
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
|
||||
break;
|
||||
case SymTagEnum:
|
||||
/* FIXME: we don't handle enum size */
|
||||
if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), FALSE, &rtn))
|
||||
if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn))
|
||||
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
|
||||
break;
|
||||
case SymTagFunctionType:
|
||||
|
@ -133,7 +137,7 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, unsigned* ps
|
|||
*/
|
||||
long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
|
||||
{
|
||||
return types_extract_as_longlong(lvalue, NULL);
|
||||
return types_extract_as_longlong(lvalue, NULL, NULL);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -150,10 +154,27 @@ void types_extract_as_address(const struct dbg_lvalue* lvalue, ADDRESS64* addr)
|
|||
else
|
||||
{
|
||||
addr->Mode = AddrModeFlat;
|
||||
addr->Offset = types_extract_as_longlong(lvalue, NULL);
|
||||
addr->Offset = types_extract_as_longlong(lvalue, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lvalue_from)
|
||||
{
|
||||
LONGLONG val;
|
||||
DWORD64 size;
|
||||
BOOL is_signed;
|
||||
|
||||
if (!types_get_info(&lvalue_to->type, TI_GET_LENGTH, &size)) return FALSE;
|
||||
if (sizeof(val) < size)
|
||||
{
|
||||
dbg_printf("Unsufficient size\n");
|
||||
return FALSE;
|
||||
}
|
||||
/* FIXME: should support floats as well */
|
||||
val = types_extract_as_longlong(lvalue_from, NULL, &is_signed);
|
||||
return be_cpu->store_integer(lvalue_to, size, is_signed, val);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* types_get_udt_element_lvalue
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue