Commit 82014111 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: extract_as_integer

- now supporting extract_as_integer on functions (so that, for example, 'disas foo' works as expected) - now properly handling errors when calling extract_as_integer
parent 06bc59cd
...@@ -37,14 +37,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg); ...@@ -37,14 +37,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
*/ */
long int types_extract_as_integer(const struct dbg_lvalue* lvalue) long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
{ {
long int rtn = 0; long int rtn;
LONGLONG val; LONGLONG val;
DWORD tag, bt; DWORD tag, bt;
DWORD64 size; DWORD64 size;
if (lvalue->type.id == dbg_itype_none || if (lvalue->type.id == dbg_itype_none ||
!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag)) !types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag))
return 0; RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
if (lvalue->type.id == dbg_itype_segptr) if (lvalue->type.id == dbg_itype_segptr)
{ {
...@@ -63,17 +63,19 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue) ...@@ -63,17 +63,19 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
if (size > sizeof(rtn)) if (size > sizeof(rtn))
{ {
WINE_ERR("Size too large (%s)\n", wine_dbgstr_longlong(size)); WINE_ERR("Size too large (%s)\n", wine_dbgstr_longlong(size));
return 0; RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
} }
switch (bt) switch (bt)
{ {
case btChar: case btChar:
case btInt: case btInt:
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, TRUE, &val)) return 0; if (!be_cpu->fetch_integer(lvalue, (unsigned)size, TRUE, &val))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
rtn = (long)val; rtn = (long)val;
break; break;
case btUInt: case btUInt:
if (!be_cpu->fetch_integer(lvalue, (unsigned)size, FALSE, &val)) return 0; if (!be_cpu->fetch_integer(lvalue, (unsigned)size, FALSE, &val))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
rtn = (DWORD)(DWORD64)val; rtn = (DWORD)(DWORD64)val;
break; break;
case btFloat: case btFloat:
...@@ -81,20 +83,26 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue) ...@@ -81,20 +83,26 @@ long int types_extract_as_integer(const struct dbg_lvalue* lvalue)
} }
break; break;
case SymTagPointerType: case SymTagPointerType:
if (!memory_read_value(lvalue, sizeof(void*), &rtn)) return 0; if (!memory_read_value(lvalue, sizeof(void*), &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break; break;
case SymTagArrayType: case SymTagArrayType:
case SymTagUDT: case SymTagUDT:
assert(lvalue->cookie == DLV_TARGET); assert(lvalue->cookie == DLV_TARGET);
if (!memory_read_value(lvalue, sizeof(rtn), &rtn)) return 0; if (!memory_read_value(lvalue, sizeof(rtn), &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break; break;
case SymTagEnum: case SymTagEnum:
assert(lvalue->cookie == DLV_TARGET); assert(lvalue->cookie == DLV_TARGET);
if (!memory_read_value(lvalue, sizeof(rtn), &rtn)) return 0; if (!memory_read_value(lvalue, sizeof(rtn), &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagFunctionType:
rtn = (unsigned)memory_to_linear_addr(&lvalue->addr);
break; break;
default: default:
WINE_FIXME("Unsupported tag %lu\n", tag); WINE_FIXME("Unsupported tag %lu\n", tag);
rtn = 0; RaiseException(DEBUG_STATUS_NOT_AN_INTEGER, 0, 0, NULL);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment