winedbg: Added basic support for printing 64bit wide entities.

This commit is contained in:
Eric Pouech 2006-11-24 22:18:51 +01:00 committed by Alexandre Julliard
parent 135f2e1b79
commit 7ca25148f4
3 changed files with 31 additions and 17 deletions

View File

@ -392,6 +392,7 @@ 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*);
extern void types_extract_as_address(const struct dbg_lvalue*, ADDRESS64*);
extern BOOL types_deref(const struct dbg_lvalue* value, struct dbg_lvalue* result);
extern BOOL types_udt_find_element(struct dbg_lvalue* value, const char* name, long int* tmpbuf);

View File

@ -466,7 +466,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
*/
void print_basic(const struct dbg_lvalue* lvalue, int count, char format)
{
long int res;
LONGLONG res;
if (lvalue->type.id == dbg_itype_none)
{
@ -474,17 +474,18 @@ void print_basic(const struct dbg_lvalue* lvalue, int count, char format)
return;
}
res = types_extract_as_integer(lvalue);
res = types_extract_as_longlong(lvalue);
/* FIXME: this implies i386 byte ordering */
switch (format)
{
case 'x':
dbg_printf("0x%lx", res);
dbg_printf("0x%lx", (DWORD)(ULONG64)res);
break;
case 'd':
dbg_printf("%ld\n", res);
dbg_print_longlong(res, TRUE);
dbg_printf("\n");
break;
case 'c':
@ -507,7 +508,10 @@ void print_basic(const struct dbg_lvalue* lvalue, int count, char format)
dbg_printf("Format specifier '%c' is meaningless in 'print' command\n", format);
case 0:
if (lvalue->type.id == dbg_itype_segptr)
dbg_printf("%ld", res);
{
dbg_print_longlong(res, TRUE);
dbg_printf("\n");
}
else
print_typed_basic(lvalue);
break;

View File

@ -48,15 +48,14 @@ BOOL types_get_real_type(struct dbg_type* type, DWORD* tag)
}
/******************************************************************
* types_extract_as_integer
* types_extract_as_longlong
*
* Given a lvalue, try to get an integral (or pointer/address) value
* out of it
*/
long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue)
{
long int rtn;
LONGLONG val;
LONGLONG rtn;
DWORD tag, bt;
DWORD64 size;
struct dbg_type type = lvalue->type;
@ -87,30 +86,29 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
{
case btChar:
case btInt:
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, TRUE, &val))
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, TRUE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
rtn = (long)val;
break;
case btUInt:
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, FALSE, &val))
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
rtn = (DWORD)(DWORD64)val;
break;
case btFloat:
RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
}
break;
case SymTagPointerType:
if (!memory_read_value(lvalue, sizeof(void*), &rtn))
if (!be_cpu->fetch_integer(lvalue, sizeof(void*), FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagArrayType:
case SymTagUDT:
if (!memory_read_value(lvalue, sizeof(rtn), &rtn))
if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagEnum:
if (!memory_read_value(lvalue, sizeof(rtn), &rtn))
/* FIXME: we don't handle enum size */
if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagFunctionType:
@ -125,6 +123,17 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
return rtn;
}
/******************************************************************
* types_extract_as_integer
*
* Given a lvalue, try to get an integral (or pointer/address) value
* out of it
*/
long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
{
return types_extract_as_longlong(lvalue);
}
/******************************************************************
* types_extract_as_address
*
@ -139,7 +148,7 @@ void types_extract_as_address(const struct dbg_lvalue* lvalue, ADDRESS64* addr)
else
{
addr->Mode = AddrModeFlat;
addr->Offset = types_extract_as_integer( lvalue );
addr->Offset = types_extract_as_longlong( lvalue );
}
}