diff --git a/debugger/debugger.h b/debugger/debugger.h index 4ee5935ded3..7776c47aef3 100644 --- a/debugger/debugger.h +++ b/debugger/debugger.h @@ -55,6 +55,7 @@ typedef struct #define DV_TARGET 0xF00D #define DV_HOST 0x50DA +#define DV_INVALID 0x0000 typedef struct { diff --git a/debugger/expr.c b/debugger/expr.c index a083fb3cdc1..4cd109b145b 100644 --- a/debugger/expr.c +++ b/debugger/expr.c @@ -302,6 +302,7 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp) struct datatype * type2; rtn.type = NULL; + rtn.cookie = DV_INVALID; rtn.addr.off = 0; rtn.addr.seg = 0; diff --git a/debugger/types.c b/debugger/types.c index 65cee4ad345..76b9ae410fd 100644 --- a/debugger/types.c +++ b/debugger/types.c @@ -761,13 +761,23 @@ DEBUG_ArrayIndex(const DBG_VALUE * value, DBG_VALUE * result, int index) */ size = DEBUG_GetObjectSize(value->type->un.pointer.pointsto); result->type = value->type->un.pointer.pointsto; - result->addr.off = (*(unsigned int*) (value->addr.off)) + size * index; + result->addr.off = (DWORD)DEBUG_ReadMemory(value) + size*index; + + /* Contents of array must be on same target */ + result->cookie = value->cookie; } else if (value->type->type == DT_ARRAY) { size = DEBUG_GetObjectSize(value->type->un.array.basictype); result->type = value->type->un.array.basictype; result->addr.off = value->addr.off + size * (index - value->type->un.array.start); + + /* Contents of array must be on same target */ + result->cookie = value->cookie; + } + else + { + assert(FALSE); } return TRUE;