From 8314cdc45eeed61629688d0e841090b373e79dd7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 26 Jun 2017 14:48:14 -0500 Subject: [PATCH] winedbg: Add support for printing floating point registers. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- programs/winedbg/be_i386.c | 14 +++++++++++--- programs/winedbg/be_x86_64.c | 14 +++++++++++--- programs/winedbg/types.c | 27 +++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c index 99e3b298c65..154d4e7c851 100644 --- a/programs/winedbg/be_i386.c +++ b/programs/winedbg/be_i386.c @@ -287,6 +287,14 @@ static struct dbg_internal_var be_i386_ctx[] = {CV_REG_FLAGS, "FLAGS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, EFlags), dbg_itype_unsigned_short_int}, {CV_REG_EIP, "EIP", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Eip), dbg_itype_unsigned_int}, {CV_REG_EFLAGS, "EFLAGS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, EFlags), dbg_itype_unsigned_int}, + {CV_REG_ST0, "ST0", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[ 0]), dbg_itype_long_real}, + {CV_REG_ST0+1, "ST1", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[10]), dbg_itype_long_real}, + {CV_REG_ST0+2, "ST2", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[20]), dbg_itype_long_real}, + {CV_REG_ST0+3, "ST3", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[30]), dbg_itype_long_real}, + {CV_REG_ST0+4, "ST4", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[40]), dbg_itype_long_real}, + {CV_REG_ST0+5, "ST5", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[50]), dbg_itype_long_real}, + {CV_REG_ST0+6, "ST6", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[60]), dbg_itype_long_real}, + {CV_REG_ST0+7, "ST7", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[70]), dbg_itype_long_real}, {0, NULL, 0, dbg_itype_none} }; @@ -767,9 +775,9 @@ static BOOL be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, if (!memory_read_value(lvalue, size, tmp)) return FALSE; /* float & double types have to be promoted to a long double */ - if (size == sizeof(float)) *ret = *(float*)tmp; - else if (size == sizeof(double)) *ret = *(double*)tmp; - else if (size == sizeof(long double)) *ret = *(long double*)tmp; + if (size == 4) *ret = *(float*)tmp; + else if (size == 8) *ret = *(double*)tmp; + else if (size == 10) *ret = *(long double*)tmp; else return FALSE; return TRUE; diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index 17feb881a3f..abb4140ba38 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -237,6 +237,14 @@ static struct dbg_internal_var be_x86_64_ctx[] = {CV_AMD64_R13, "R13", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, R13), dbg_itype_unsigned_long_int}, {CV_AMD64_R14, "R14", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, R14), dbg_itype_unsigned_long_int}, {CV_AMD64_R15, "R15", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, R15), dbg_itype_unsigned_long_int}, + {CV_AMD64_ST0, "ST0", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[0]), dbg_itype_long_real}, + {CV_AMD64_ST0+1, "ST1", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[1]), dbg_itype_long_real}, + {CV_AMD64_ST0+2, "ST2", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[2]), dbg_itype_long_real}, + {CV_AMD64_ST0+3, "ST3", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[3]), dbg_itype_long_real}, + {CV_AMD64_ST0+4, "ST4", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[4]), dbg_itype_long_real}, + {CV_AMD64_ST0+5, "ST5", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[5]), dbg_itype_long_real}, + {CV_AMD64_ST0+6, "ST6", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[6]), dbg_itype_long_real}, + {CV_AMD64_ST0+7, "ST7", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[7]), dbg_itype_long_real}, {0, NULL, 0, dbg_itype_none} }; @@ -631,9 +639,9 @@ static BOOL be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size if (!memory_read_value(lvalue, size, tmp)) return FALSE; /* float & double types have to be promoted to a long double */ - if (size == sizeof(float)) *ret = *(float*)tmp; - else if (size == sizeof(double)) *ret = *(double*)tmp; - else if (size == sizeof(long double)) *ret = *(long double*)tmp; + if (size == 4) *ret = *(float*)tmp; + else if (size == 8) *ret = *(double*)tmp; + else if (size == 10) *ret = *(long double*)tmp; else return FALSE; return TRUE; diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 2df75722716..f050db59a63 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -894,6 +894,33 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v default: WINE_FIXME("unsupported %u for seg-ptr\n", ti); return FALSE; } break; + case dbg_itype_short_real: + switch (ti) + { + case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break; + case TI_GET_LENGTH: X(DWORD64) = 4; break; + case TI_GET_BASETYPE: X(DWORD) = btFloat; break; + default: WINE_FIXME("unsupported %u for short real\n", ti); return FALSE; + } + break; + case dbg_itype_real: + switch (ti) + { + case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break; + case TI_GET_LENGTH: X(DWORD64) = 8; break; + case TI_GET_BASETYPE: X(DWORD) = btFloat; break; + default: WINE_FIXME("unsupported %u for real\n", ti); return FALSE; + } + break; + case dbg_itype_long_real: + switch (ti) + { + case TI_GET_SYMTAG: X(DWORD) = SymTagBaseType; break; + case TI_GET_LENGTH: X(DWORD64) = 10; break; + case TI_GET_BASETYPE: X(DWORD) = btFloat; break; + default: WINE_FIXME("unsupported %u for long real\n", ti); return FALSE; + } + break; default: WINE_FIXME("unsupported type id 0x%lx\n", type->id); }