Module: wine
Branch: master
Commit: 16fb9640d72be2bbd1b1764434798a5315d4fbcb
URL: https://source.winehq.org/git/wine.git/?a=commit;h=16fb9640d72be2bbd1b17644…
Author: Eric Pouech <eric.pouech(a)gmail.com>
Date: Fri Nov 26 17:30:40 2021 +0100
winedbg: Get size of underlying integral types in enums.
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
programs/winedbg/memory.c | 10 +++++-----
programs/winedbg/types.c | 4 ++--
programs/winedbg/winedbg.c | 1 -
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c
index 9000d0126c7..b736d06a67e 100644
--- a/programs/winedbg/memory.c
+++ b/programs/winedbg/memory.c
@@ -439,11 +439,8 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
{
BOOL ok = FALSE;
- /* FIXME: it depends on underlying type for enums
- * (not supported yet in dbghelp)
- * Assuming 4 as for an int
- */
- if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, 4, TRUE, &val_int)) return;
+ if (!types_get_info(&type, TI_GET_LENGTH, &size64) ||
+ !dbg_curr_process->be_cpu->fetch_integer(lvalue, size64, TRUE, &val_int)) return;
if (types_get_info(&type, TI_GET_CHILDRENCOUNT, &count))
{
@@ -468,7 +465,10 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
continue;
switch (V_VT(&variant))
{
+ case VT_I1: ok = (val_int == V_I1(&variant)); break;
+ case VT_I2: ok = (val_int == V_I2(&variant)); break;
case VT_I4: ok = (val_int == V_I4(&variant)); break;
+ case VT_I8: ok = (val_int == V_I8(&variant)); break;
default: WINE_FIXME("Unsupported variant type (%u)\n", V_VT(&variant));
}
if (ok)
diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c
index 9d98a136428..354c97e5d70 100644
--- a/programs/winedbg/types.c
+++ b/programs/winedbg/types.c
@@ -114,8 +114,8 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue,
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagEnum:
- /* FIXME: we don't handle enum size */
- if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn))
+ if (!types_get_info(&type, TI_GET_LENGTH, &size) ||
+ !dbg_curr_process->be_cpu->fetch_integer(lvalue, (unsigned)size, s = FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagFunctionType:
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 45a7edfb309..0d4a38b2d83 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -44,7 +44,6 @@
* - type management:
* + some bits of internal types are missing (like type casts and the address
* operator)
- * + the type for an enum's value is always inferred as int (winedbg & dbghelp)
* + most of the code implies that sizeof(void*) = sizeof(int)
* + all computations should be made on long long
* o expr computations are in int:s