winedbg: Fixed the print_basic command when dealing with long long values.

This commit is contained in:
Eric Pouech 2008-05-23 20:05:01 +02:00 committed by Alexandre Julliard
parent 98e2486820
commit f7f9c08fc0
3 changed files with 15 additions and 7 deletions

View file

@ -417,7 +417,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 types_print_type(const struct dbg_type*, BOOL details);
extern int print_types(void); extern int print_types(void);
extern long int types_extract_as_integer(const struct dbg_lvalue*); extern long int types_extract_as_integer(const struct dbg_lvalue*);
extern LONGLONG types_extract_as_longlong(const struct dbg_lvalue*); extern LONGLONG types_extract_as_longlong(const struct dbg_lvalue*, unsigned* psize);
extern void types_extract_as_address(const struct dbg_lvalue*, ADDRESS64*); 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_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); extern BOOL types_udt_find_element(struct dbg_lvalue* value, const char* name, long int* tmpbuf);

View file

@ -474,14 +474,20 @@ void print_basic(const struct dbg_lvalue* lvalue, char format)
if (format != 0) if (format != 0)
{ {
LONGLONG res = types_extract_as_longlong(lvalue); unsigned size;
LONGLONG res = types_extract_as_longlong(lvalue, &size);
DWORD hi;
WCHAR wch; WCHAR wch;
/* FIXME: this implies i386 byte ordering */ /* FIXME: this implies i386 byte ordering */
switch (format) switch (format)
{ {
case 'x': case 'x':
dbg_printf("0x%x", (DWORD)(ULONG64)res); hi = (ULONG64)res >> 32;
if (size == 8 && hi)
dbg_printf("0x%x%08x", hi, (DWORD)res);
else
dbg_printf("0x%x", (DWORD)res);
return; return;
case 'd': case 'd':
@ -509,7 +515,7 @@ void print_basic(const struct dbg_lvalue* lvalue, char format)
} }
if (lvalue->type.id == dbg_itype_segptr) if (lvalue->type.id == dbg_itype_segptr)
{ {
dbg_print_longlong(types_extract_as_longlong(lvalue), TRUE); dbg_print_longlong(types_extract_as_longlong(lvalue, NULL), TRUE);
dbg_printf("\n"); dbg_printf("\n");
} }
else print_typed_basic(lvalue); else print_typed_basic(lvalue);

View file

@ -53,7 +53,7 @@ BOOL types_get_real_type(struct dbg_type* type, DWORD* tag)
* Given a lvalue, try to get an integral (or pointer/address) value * Given a lvalue, try to get an integral (or pointer/address) value
* out of it * out of it
*/ */
LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue) LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue, unsigned* psize)
{ {
LONGLONG rtn; LONGLONG rtn;
DWORD tag, bt; DWORD tag, bt;
@ -68,6 +68,7 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue)
return (long int)memory_to_linear_addr(&lvalue->addr); return (long int)memory_to_linear_addr(&lvalue->addr);
} }
if (psize) *psize = 0;
switch (tag) switch (tag)
{ {
case SymTagBaseType: case SymTagBaseType:
@ -96,6 +97,7 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue)
case btFloat: case btFloat:
RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL); RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
} }
if (psize) *psize = (unsigned)size;
break; break;
case SymTagPointerType: case SymTagPointerType:
if (!be_cpu->fetch_integer(lvalue, sizeof(void*), FALSE, &rtn)) if (!be_cpu->fetch_integer(lvalue, sizeof(void*), FALSE, &rtn))
@ -131,7 +133,7 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue)
*/ */
long int types_extract_as_integer(const struct dbg_lvalue* lvalue) long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
{ {
return types_extract_as_longlong(lvalue); return types_extract_as_longlong(lvalue, NULL);
} }
/****************************************************************** /******************************************************************
@ -148,7 +150,7 @@ void types_extract_as_address(const struct dbg_lvalue* lvalue, ADDRESS64* addr)
else else
{ {
addr->Mode = AddrModeFlat; addr->Mode = AddrModeFlat;
addr->Offset = types_extract_as_longlong( lvalue ); addr->Offset = types_extract_as_longlong(lvalue, NULL);
} }
} }