QString WatchItem::expression() const { if (!exp.isEmpty()) return QString::fromLatin1(exp); if (quint64 addr = realAddress()) { if (!type.isEmpty()) return QString::fromLatin1("*(%1*)0x%2").arg(QLatin1String(type)).arg(addr, 0, 16); } const WatchItem *p = parentItem(); if (p && !p->exp.isEmpty()) return QString::fromLatin1("(%1).%2").arg(QString::fromLatin1(p->exp), name); return name; }
QString WatchItem::toToolTip() const { QString res; QTextStream str(&res); str << "<html><body><table>"; formatToolTipRow(str, tr("Name"), name); formatToolTipRow(str, tr("Expression"), expression()); formatToolTipRow(str, tr("Internal Type"), QLatin1String(type)); bool ok; const quint64 intValue = value.toULongLong(&ok); if (ok && intValue) { formatToolTipRow(str, tr("Value"), QLatin1String("(dec) ") + value); formatToolTipRow(str, QString(), QLatin1String("(hex) ") + QString::number(intValue, 16)); formatToolTipRow(str, QString(), QLatin1String("(oct) ") + QString::number(intValue, 8)); formatToolTipRow(str, QString(), QLatin1String("(bin) ") + QString::number(intValue, 2)); } else { QString val = value; if (val.size() > 1000) { val.truncate(1000); val += QLatin1Char(' '); val += tr("... <cut off>"); } formatToolTipRow(str, tr("Value"), val); } if (realAddress()) formatToolTipRow(str, tr("Object Address"), formatToolTipAddress(realAddress())); if (origaddr) formatToolTipRow(str, tr("Pointer Address"), formatToolTipAddress(origaddr)); if (arrayIndex >= 0) formatToolTipRow(str, tr("Array Index"), QString::number(arrayIndex)); if (size) formatToolTipRow(str, tr("Static Object Size"), tr("%n bytes", 0, size)); formatToolTipRow(str, tr("Internal ID"), QLatin1String(internalName())); str << "</table></body></html>"; return res; }
//--------------------------------------------------------------------------------------------------------------- int createCompiledFunction3(int fntype, int fn, int code1, int code2, int code3) { int sizes1=((int *)code1)[0]; int sizes2=((int *)code2)[0]; int sizes3=((int *)code3)[0]; if (fntype == MATH_FN && fn == 0) // special case: IF { void *func3; int size; int *ptr; char *block; unsigned char *newblock2,*newblock3; newblock2=newBlock(sizes2+1); memcpy(newblock2,(char*)code2+4,sizes2); newblock2[sizes2]=X86_RET; newblock3=newBlock(sizes3+1); memcpy(newblock3,(char*)code3+4,sizes3); newblock3[sizes3]=X86_RET; l_stats[2]+=sizes2+sizes3+2; func3 = realAddress(_asm_if,_asm_if_end,&size); block=(char *)newTmpBlock(4+sizes1+size); ((int*)block)[0]=sizes1+size; memcpy(block+4,(char*)code1+4,sizes1); ptr=(int *)(block+4+sizes1); memcpy(ptr,func3,size); ptr=findFBlock((char*)ptr); *ptr++=(int)newblock2; ptr=findFBlock((char*)ptr); *ptr=(int)newblock3; return (int)block; } else { int size2; unsigned char *block; unsigned char *outp; int myfunc; myfunc = getFunctionAddress(fntype, fn, &size2); block=(unsigned char *)newTmpBlock(4+size2+sizes1+sizes2+sizes3+4); ((int*)block)[0]=4+size2+sizes1+sizes2+sizes3; outp=block+4; memcpy(outp,(char*)code1+4,sizes1); outp+=sizes1; *outp++ = X86_PUSH_EAX; memcpy(outp,(char*)code2+4,sizes2); outp+=sizes2; *outp++ = X86_PUSH_EAX; memcpy(outp,(char*)code3+4,sizes3); outp+=sizes3; *outp++ = X86_POP_EBX; *outp++ = X86_POP_ECX; memcpy(block+4+4+sizes1+sizes2+sizes3,(void*)myfunc,size2); g_evallib_computTableTop++; return ((int)(block)); } }
//--------------------------------------------------------------------------------------------------------------- int getFunctionAddress(int fntype, int fn, int *size) { switch (fntype) { case MATH_SIMPLE: switch (fn) { case FN_ASSIGN: return (int)realAddress(_asm_assign,_asm_assign_end,size); case FN_ADD: return (int)realAddress(_asm_add,_asm_add_end,size); case FN_SUB: return (int)realAddress(_asm_sub,_asm_sub_end,size); case FN_MULTIPLY: return (int)realAddress(_asm_mul,_asm_mul_end,size); case FN_DIVIDE: return (int)realAddress(_asm_div,_asm_div_end,size); case FN_MODULO: return (int)realAddress(_asm_mod,_asm_mod_end,size); case FN_AND: return (int)realAddress(_asm_and,_asm_and_end,size); case FN_OR: return (int)realAddress(_asm_or,_asm_or_end,size); case FN_UPLUS: return (int)realAddress(_asm_uplus,_asm_uplus_end,size); case FN_UMINUS: return (int)realAddress(_asm_uminus,_asm_uminus_end,size); } case MATH_FN: { functionType *p=getFunctionFromTable(fn); if (!p) { if (size) *size=0; return 0; } return (int)realAddress(p->afunc,p->func_e,size); } } return 0; }