Changeset 35637 in vbox
- Timestamp:
- Jan 19, 2011 5:42:59 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dbg.h
r35626 r35637 61 61 /** Any type is fine. */ 62 62 DBGCVAR_CAT_ANY = 0, 63 /** Any kind of pointer or number. */ 64 DBGCVAR_CAT_POINTER_NUMBER, 65 /** Any kind of pointer or number, no range. */ 66 DBGCVAR_CAT_POINTER_NUMBER_NO_RANGE, 63 67 /** Any kind of pointer. */ 64 68 DBGCVAR_CAT_POINTER, -
trunk/src/VBox/Debugger/DBGCCmdHlp.cpp
r35632 r35637 673 673 /* ignore overflows. */ 674 674 675 return dbgcEvalSub(pDbgc, &szExprFormatted[0], cb, pResult);675 return dbgcEvalSub(pDbgc, &szExprFormatted[0], cb, DBGCVAR_CAT_ANY, pResult); 676 676 } 677 677 -
trunk/src/VBox/Debugger/DBGCEval.cpp
r35632 r35637 163 163 /* 164 164 * Pointer with and without range. 165 * We can try resolve strings and symbols as symbols and 166 * promotenumbers to flat GC pointers.165 * We can try resolve strings and symbols as symbols and promote 166 * numbers to flat GC pointers. 167 167 */ 168 168 case DBGCVAR_CAT_POINTER_NO_RANGE: 169 case DBGCVAR_CAT_POINTER_NUMBER_NO_RANGE: 169 170 if (pVar->enmRangeType != DBGCVAR_RANGE_NONE) 170 171 return VERR_PARSE_NO_RANGE_ALLOWED; 171 172 /* fallthru */ 172 173 case DBGCVAR_CAT_POINTER: 174 case DBGCVAR_CAT_POINTER_NUMBER: 173 175 switch (pVar->enmType) 174 176 { … … 202 204 203 205 case DBGCVAR_TYPE_NUMBER: 204 { 205 RTGCPTR GCPtr = (RTGCPTR)pVar->u.u64Number; 206 pVar->enmType = DBGCVAR_TYPE_GC_FLAT; 207 pVar->u.GCFlat = GCPtr; 206 if ( pVarDesc->enmCategory != DBGCVAR_CAT_POINTER_NUMBER 207 && pVarDesc->enmCategory != DBGCVAR_CAT_POINTER_NUMBER_NO_RANGE) 208 { 209 RTGCPTR GCPtr = (RTGCPTR)pVar->u.u64Number; 210 pVar->enmType = DBGCVAR_TYPE_GC_FLAT; 211 pVar->u.GCFlat = GCPtr; 212 } 208 213 return VINF_SUCCESS; 209 }210 214 211 215 default: … … 443 447 * @param pDbgc Debugger console instance data. 444 448 * @param pszExpr The expression string. 449 * @param cchExpr The length of the expression. 450 * @param enmCategory The target category for the result. 445 451 * @param pResult Where to store the result of the expression evaluation. 446 452 */ 447 static int dbgcEvalSubUnary(PDBGC pDbgc, char *pszExpr, size_t cchExpr, PDBGCVAR pResult)453 static int dbgcEvalSubUnary(PDBGC pDbgc, char *pszExpr, size_t cchExpr, DBGCVARCAT enmCategory, PDBGCVAR pResult) 448 454 { 449 455 Log2(("dbgcEvalSubUnary: cchExpr=%d pszExpr=%s\n", cchExpr, pszExpr)); … … 480 486 DBGCVAR Arg; 481 487 if (*pszExpr2 == '(') 482 rc = dbgcEvalSub(pDbgc, pszExpr2, cchExpr - (pszExpr2 - pszExpr), &Arg);488 rc = dbgcEvalSub(pDbgc, pszExpr2, cchExpr - (pszExpr2 - pszExpr), pOp->enmCatArg1, &Arg); 483 489 else 484 rc = dbgcEvalSubUnary(pDbgc, pszExpr2, cchExpr - (pszExpr2 - pszExpr), &Arg);490 rc = dbgcEvalSubUnary(pDbgc, pszExpr2, cchExpr - (pszExpr2 - pszExpr), pOp->enmCatArg1, &Arg); 485 491 if (RT_SUCCESS(rc)) 486 492 rc = pOp->pfnHandlerUnary(pDbgc, &Arg, pResult); … … 531 537 /** @todo implement multiple arguments. */ 532 538 DBGCVAR Arg; 533 rc = dbgcEvalSub(pDbgc, pszExpr, cchExpr, &Arg);539 rc = dbgcEvalSub(pDbgc, pszExpr, cchExpr, enmCategory, &Arg); 534 540 if (!rc) 535 541 { … … 541 547 rc = pFun->pfnHandler(pFun, &pDbgc->CmdHlp, pDbgc->pVM, NULL, 0, pResult); 542 548 } 549 else if ( enmCategory == DBGCVAR_CAT_STRING 550 || enmCategory == DBGCVAR_CAT_SYMBOL) 551 rc = dbgcEvalSubString(pDbgc, pszExpr, cchExpr, pResult); 543 552 else 544 553 { … … 590 599 * @param pDbgc Debugger console instance data. 591 600 * @param pszExpr The expression string. 601 * @param enmCategory The target category for the result. 592 602 * @param pResult Where to store the result of the expression evaluation. 593 603 */ 594 int dbgcEvalSub(PDBGC pDbgc, char *pszExpr, size_t cchExpr, PDBGCVAR pResult)604 int dbgcEvalSub(PDBGC pDbgc, char *pszExpr, size_t cchExpr, DBGCVARCAT enmCategory, PDBGCVAR pResult) 595 605 { 596 606 Log2(("dbgcEvalSub: cchExpr=%d pszExpr=%s\n", cchExpr, pszExpr)); … … 752 762 *pszOpSplit = '\0'; 753 763 DBGCVAR Arg1; 754 rc = dbgcEvalSub(pDbgc, pszExpr, pszOpSplit - pszExpr, &Arg1);764 rc = dbgcEvalSub(pDbgc, pszExpr, pszOpSplit - pszExpr, pOpSplit->enmCatArg1, &Arg1); 755 765 if (RT_SUCCESS(rc)) 756 766 { … … 758 768 char *psz2 = pszOpSplit + pOpSplit->cchName; 759 769 DBGCVAR Arg2; 760 rc = dbgcEvalSub(pDbgc, psz2, cchExpr - (psz2 - pszExpr), &Arg2);770 rc = dbgcEvalSub(pDbgc, psz2, cchExpr - (psz2 - pszExpr), pOpSplit->enmCatArg2, &Arg2); 761 771 if (RT_SUCCESS(rc)) 762 772 /* apply the operator. */ … … 769 779 pszOpSplit += pOpSplit->cchName; 770 780 DBGCVAR Arg; 771 rc = dbgcEvalSub(pDbgc, pszOpSplit, cchExpr - (pszOpSplit - pszExpr), &Arg);781 rc = dbgcEvalSub(pDbgc, pszOpSplit, cchExpr - (pszOpSplit - pszExpr), pOpSplit->enmCatArg1, &Arg); 772 782 if (RT_SUCCESS(rc)) 773 783 /* apply the operator. */ … … 776 786 else 777 787 /* plain expression or using unary operators perhaps with parentheses. */ 778 rc = dbgcEvalSubUnary(pDbgc, pszExpr, cchExpr, pResult);788 rc = dbgcEvalSubUnary(pDbgc, pszExpr, cchExpr, enmCategory, pResult); 779 789 780 790 return rc; … … 825 835 && pCmd->cArgsMin == 1 826 836 && pCmd->cArgDescs == 1 827 && pCmd->paArgDescs[0].enmCategory == DBGCVAR_CAT_STRING 837 && ( pCmd->paArgDescs[0].enmCategory == DBGCVAR_CAT_STRING 838 || pCmd->paArgDescs[0].enmCategory == DBGCVAR_CAT_SYMBOL) 828 839 && cArgs >= 1) 829 840 { … … 832 843 return dbgcEvalSubString(pDbgc, pszArgs, strlen(pszArgs), &paArgs[0]); 833 844 } 834 835 845 836 846 /* … … 962 972 * Parse and evaluate the argument. 963 973 */ 964 int rc = dbgcEvalSub(pDbgc, pszArgs, strlen(pszArgs), pArg);974 int rc = dbgcEvalSub(pDbgc, pszArgs, strlen(pszArgs), DBGCVAR_CAT_ANY, pArg); 965 975 if (RT_FAILURE(rc)) 966 976 return rc; -
trunk/src/VBox/Debugger/DBGCInternal.h
r35629 r35637 316 316 /** Binary operator handler. */ 317 317 PFNDBGCOPBINARY pfnHandlerBinary; 318 /** The category of the 1st argument. 319 * Set to DBGCVAR_CAT_ANY if anything goes. */ 320 DBGCVARCAT enmCatArg1; 321 /** The category of the 2nd argument. 322 * Set to DBGCVAR_CAT_ANY if anything goes. */ 323 DBGCVARCAT enmCatArg2; 318 324 /** Operator description. */ 319 325 const char *pszDescription; … … 397 403 398 404 void dbgcEvalInit(void); 399 int dbgcEvalSub(PDBGC pDbgc, char *pszExpr, size_t cchExpr, PDBGCVAR pResult);405 int dbgcEvalSub(PDBGC pDbgc, char *pszExpr, size_t cchExpr, DBGCVARCAT enmCategory, PDBGCVAR pResult); 400 406 int dbgcEvalCommand(PDBGC pDbgc, char *pszCmd, size_t cchCmd, bool fNoExecute); 401 407 -
trunk/src/VBox/Debugger/DBGCOps.cpp
r35628 r35637 156 156 /* szName is initialized as a 4 char array because of M$C elsewise optimizing it away in /Ox mode (the 'const char' vs 'char' problem). */ 157 157 /* szName, cchName, fBinary, iPrecedence, pfnHandlerUnary, pfnHandlerBitwise */ 158 { {'-'}, 1, false, 1, dbgcOpMinus, NULL, "Unary minus." },159 { {'+'}, 1, false, 1, dbgcOpPluss, NULL, "Unary plus."},160 { {'!'}, 1, false, 1, dbgcOpBooleanNot, NULL, "Boolean not." },161 { {'~'}, 1, false, 1, dbgcOpBitwiseNot, NULL, "Bitwise complement." },162 { {':'}, 1, true, 2, NULL, dbgcOpAddrFar, "Far pointer." },163 { {'%'}, 1, false, 3, dbgcOpAddrFlat, NULL, "Flat address." },164 { {'%','%'}, 2, false, 3, dbgcOpAddrPhys, NULL, "Physical address." },165 { {'#'}, 1, false, 3, dbgcOpAddrHost, NULL, "Flat host address." },166 { {'#','%','%'}, 3, false, 3, dbgcOpAddrHostPhys, NULL, "Physical host address." },167 { {'$'}, 1, false, 3, dbgcOpVar, NULL, "Reference a variable." },168 { {'@'}, 1, false, 3, dbgcOpRegister, NULL, "Reference a register." },169 { {'*'}, 1, true, 10, NULL, dbgcOpMult, "Multiplication." },170 { {'/'}, 1, true, 11, NULL, dbgcOpDiv, "Division." },171 { {'%'}, 1, true, 12, NULL, dbgcOpMod, "Modulus." },172 { {'+'}, 1, true, 13, NULL, dbgcOpAdd, "Addition." },173 { {'-'}, 1, true, 14, NULL, dbgcOpSub, "Subtraction." },174 { {'<','<'}, 2, true, 15, NULL, dbgcOpBitwiseShiftLeft, "Bitwise left shift." },175 { {'>','>'}, 2, true, 16, NULL, dbgcOpBitwiseShiftRight, "Bitwise right shift." },176 { {'&'}, 1, true, 17, NULL, dbgcOpBitwiseAnd, "Bitwise and." },177 { {'^'}, 1, true, 18, NULL, dbgcOpBitwiseXor, "Bitwise exclusiv or." },178 { {'|'}, 1, true, 19, NULL, dbgcOpBitwiseOr, "Bitwise inclusive or." },179 { {'&','&'}, 2, true, 20, NULL, dbgcOpBooleanAnd, "Boolean and." },180 { {'|','|'}, 2, true, 21, NULL, dbgcOpBooleanOr, "Boolean or." },181 { {'L'}, 1, true, 22, NULL, dbgcOpRangeLength, "Range elements." },182 { {'L','B'}, 2, true, 23, NULL, dbgcOpRangeLengthBytes, "Range bytes." },183 { {'T'}, 1, true, 24, NULL, dbgcOpRangeTo, "Range to." }158 { {'-'}, 1, false, 1, dbgcOpMinus, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Unary minus." }, 159 { {'+'}, 1, false, 1, dbgcOpPluss, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Unary plus." }, 160 { {'!'}, 1, false, 1, dbgcOpBooleanNot, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Boolean not." }, 161 { {'~'}, 1, false, 1, dbgcOpBitwiseNot, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Bitwise complement." }, 162 { {':'}, 1, true, 2, NULL, dbgcOpAddrFar, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Far pointer." }, 163 { {'%'}, 1, false, 3, dbgcOpAddrFlat, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Flat address." }, 164 { {'%','%'}, 2, false, 3, dbgcOpAddrPhys, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Physical address." }, 165 { {'#'}, 1, false, 3, dbgcOpAddrHost, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Flat host address." }, 166 { {'#','%','%'}, 3, false, 3, dbgcOpAddrHostPhys, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Physical host address." }, 167 { {'$'}, 1, false, 3, dbgcOpVar, NULL, DBGCVAR_CAT_STRING, DBGCVAR_CAT_ANY, "Reference a variable." }, 168 { {'@'}, 1, false, 3, dbgcOpRegister, NULL, DBGCVAR_CAT_STRING, DBGCVAR_CAT_ANY, "Reference a register." }, 169 { {'*'}, 1, true, 10, NULL, dbgcOpMult, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Multiplication." }, 170 { {'/'}, 1, true, 11, NULL, dbgcOpDiv, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Division." }, 171 { {'%'}, 1, true, 12, NULL, dbgcOpMod, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Modulus." }, 172 { {'+'}, 1, true, 13, NULL, dbgcOpAdd, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Addition." }, 173 { {'-'}, 1, true, 14, NULL, dbgcOpSub, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Subtraction." }, 174 { {'<','<'}, 2, true, 15, NULL, dbgcOpBitwiseShiftLeft, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Bitwise left shift." }, 175 { {'>','>'}, 2, true, 16, NULL, dbgcOpBitwiseShiftRight, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Bitwise right shift." }, 176 { {'&'}, 1, true, 17, NULL, dbgcOpBitwiseAnd, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Bitwise and." }, 177 { {'^'}, 1, true, 18, NULL, dbgcOpBitwiseXor, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Bitwise exclusiv or." }, 178 { {'|'}, 1, true, 19, NULL, dbgcOpBitwiseOr, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Bitwise inclusive or." }, 179 { {'&','&'}, 2, true, 20, NULL, dbgcOpBooleanAnd, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Boolean and." }, 180 { {'|','|'}, 2, true, 21, NULL, dbgcOpBooleanOr, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Boolean or." }, 181 { {'L'}, 1, true, 22, NULL, dbgcOpRangeLength, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Range elements." }, 182 { {'L','B'}, 2, true, 23, NULL, dbgcOpRangeLengthBytes, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Range bytes." }, 183 { {'T'}, 1, true, 24, NULL, dbgcOpRangeTo, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Range to." } 184 184 }; 185 185
Note:
See TracChangeset
for help on using the changeset viewer.