From 7ca25148f47a03084bf83df094eac2d230d62577 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Fri, 24 Nov 2006 22:18:51 +0100 Subject: [PATCH] winedbg: Added basic support for printing 64bit wide entities. --- programs/winedbg/debugger.h | 1 + programs/winedbg/memory.c | 14 +++++++++----- programs/winedbg/types.c | 33 +++++++++++++++++++++------------ 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index e436956384b..67b84ba248a 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -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); diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index cdfc14934c2..d4fb7c345d3 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -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; diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index da6266966a1..ca7fd063f3b 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -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: @@ -126,6 +124,17 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue) } /****************************************************************** + * 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 ); } } -- 2.11.4.GIT