winedbg: Get size of underlying integral types in enums.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-11-26 17:30:40 +01:00 committed by Alexandre Julliard
parent 5b54dac338
commit 16fb9640d7
3 changed files with 7 additions and 8 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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