void ExpandPointer(VARINFO *v, int code, int page) { if (v->pointer) { if (code == TVE_EXPAND) { int val; int outofscope = (val = v->derefaddress) == -1 && !ReadValue(v->address, &val, 4, v) || !val; if (!v->subtype && watchinfo_list[page][v->watchindex].dbg_info) { TreeView_DeleteItem(hwndTree[page], v->hTreeHolder); ExpandPointerInfo(watchinfo_list[page][v->watchindex].dbg_info, v); if (v->subtype->structure) { InsertSubTree(v->hTreeItem, 0, v->subtype->subtype, v->watchindex, page); } else InsertSubTree(v->hTreeItem, 0, v->subtype, v->watchindex, page); } RefreshAddresses(v->subtype, val, NULL, outofscope); RefreshData(watchinfo_list[page][v->watchindex].dbg_info, v); } else if (code == TVE_COLLAPSE) { if (v->subtype) { FreeTree(v->subtype, page); FreeVarInfo(v->subtype); v->subtype = 0; v->hTreeHolder = InsertItem(v->hTreeItem, TVI_LAST, v, page); } } } }
static void RefreshAddresses(WATCHDATA *ptr, VARINFO *var, int address, THREAD *thread, int noscope) { ptr->structNesting[ptr->nestingCount++] = var; while (var) { char buf[1048]; int unscope = noscope; var->scope = ptr->structNesting[0]->scope; if (noscope) var->outofscope = TRUE; else { int val; var->outofscope = FALSE; if (thread) var->thread = thread; if (var->offset == -1) { DEBUG_INFO *dbg; int i; char name[2048]; name[0] = 0; for (i=0; i < ptr->nestingCount-1; i++) sprintf(name + strlen(name), "%s", ptr->structNesting[i]->structtag); sprintf(name + strlen(name), "@%s", var->membername); dbg = findDebug(ptr->structNesting[0]->scope->address); val = var->address = GetSymbolAddress(dbg, name); // static member data } else { val = var->address = address + var->offset; } if (var->constant) val = var->address; else if (var->pointer) { unscope = ((val = var->derefaddress) == -1 && !ReadValue(var->address, &val, 4, var)) || !val; } RefreshAddresses(ptr, var->subtype, val, thread, unscope); } var = var->link; } ptr->nestingCount--; }
void RefreshAddresses(VARINFO *var, int address, THREAD *thread, int noscope) { while (var) { int unscope = noscope; int val; if (noscope) var->outofscope = TRUE; else { var->outofscope = FALSE; if (thread) var->thread = thread; val = var->address = address + var->offset; if (var->pointer) { unscope = (val = var->derefaddress) == -1 && !ReadValue(var->address, &val, 4, var) || !val; } } RefreshAddresses(var->subtype, val, thread, unscope); var = var->link; } }
static void ExpandPointer(VARINFO *v, int code, WATCHDATA *ptr) { if (v->pointer) { if (code == TVE_EXPAND) { int val; int outofscope; outofscope = ((val = v->derefaddress) == -1 && !ReadValue(v->address, &val, 4, v)) || !val; if (!v->subtype && ptr->watchinfo_list[v->watchindex].dbg_info) { TreeView_DeleteItem(ptr->hwndWatchTree, v->hTreeHolder); ExpandPointerInfo(ptr->watchinfo_list[v->watchindex].dbg_info, v); if (v->subtype->structure) { InsertSubTree(v->hTreeItem, 0, v->subtype->subtype, v->watchindex, ptr); } else InsertSubTree(v->hTreeItem, 0, v->subtype, v->watchindex, ptr); } ptr->structNesting[ptr->nestingCount++] = v; RefreshAddresses(ptr, v->subtype, val, NULL, outofscope); ptr->nestingCount--; RefreshData(ptr->watchinfo_list[v->watchindex].dbg_info, v, TRUE); } else if (code == TVE_COLLAPSE) { if (v->subtype && !v->derefaddress) { FreeTree(v->subtype, ptr); FreeVarInfo(v->subtype); v->subtype = 0; v->hTreeHolder = InsertItem(v->hTreeItem, TVI_LAST, v, ptr); } } } }
void ChangeData(VARINFO *info, char *text, int page) { if (info->type >= eFloat && info->type <= eImaginaryLongDouble) { float v; double v2; char data[10]; sscanf(text, "%f", &v); switch (info->type) { case eFloat: case eImaginary: WriteValue(info->address, &v, 4, &info->thread->regs); break; case eDouble: case eImaginaryDouble: v2 = v; WriteValue(info->address, &v2, 8, &info->thread->regs); break; case eLongDouble: case eImaginaryLongDouble: *(long double*)data = v; WriteValue(info->address, data, 10, &info->thread->regs); break; default: break; } } else if (info->type >= eComplex && info->type <= eComplexLongDouble) { float v[2]; double v2[2]; long double v4[2]; sscanf(text, "%f + %f * I", &v[0],&v[1]); switch (info->type) { case eComplex: WriteValue(info->address, &v[0], 8, &info->thread->regs); break ; case eComplexDouble: v2[0] = v[0]; v2[1] = v[1]; WriteValue(info->address, &v2[0], 16, &info->thread->regs); break ; case eComplexLongDouble: v4[0] = v[0]; v4[1] = v[1]; WriteValue(info->address, &v4[0], 20, &info->thread->regs); break ; } } else { LLONG_TYPE value; int size; if (info->enumx && !isdigit(text[0])) { value = GetEnumValue(watchinfo_list[page][info->watchindex].dbg_info, info, text); size = 4; } else { if (text[0] == '0' && text[1] == 'x') sscanf(text + 2, "%Lx", &value); else if ((text[strlen(text) - 1] & 0xDF) == 'H') sscanf(text, "%Lx", &value); else sscanf(text, "%Ld", &value); switch (info->type) { case eBool: case eBit: case eChar: case eUChar: size = 1; break; case eShort: case eUShort: case eChar16T: case eWcharT: size = 2; break; case eInt: case eLong: case eUInt: case eULong: size = 4; break; case eLongLong: case eULongLong: size = 8; break; } } if (info->bitfield) { char data[10]; int signedx; int v; HintBasicValue(info, &signedx, &data); v = *(int*)data; v &= ~(bitmask[info->bitlength - 1] << info->bitstart); value = v | ((value &bitmask[info->bitlength - 1]) << info ->bitstart); } WriteValue(info->address, &value, size, &info->thread->regs); if (info->pointer) { if (!value && info->subtype) { VARINFO *inf = info->subtype; info->subtype = 0; FreeTree(inf, page); FreeVarInfo(inf); } else RefreshAddresses(info->subtype, value, NULL, info->outofscope); } } RefreshData(watchinfo_list[page][info->watchindex].dbg_info, info); }
void RefreshItem(WATCHINFO *var, int address, THREAD *thread) { RefreshAddresses(var->info, address, thread, var->info->outofscope); RefreshData(var->dbg_info, var->info); }
static void RefreshItem(WATCHDATA *ptr, WATCHINFO *var, int address, THREAD *thread, BOOL adding) { RefreshAddresses(ptr, var->info, address, thread, var->info->outofscope); RefreshData(var->dbg_info, var->info,adding); }