Changeset 4213 in vbox
- Timestamp:
- Aug 18, 2007 3:28:45 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 23707
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dbg.h
r4071 r4213 99 99 } DBGCVARTYPE; 100 100 101 /** @todo Rename to DBGCVAR_IS_xyz. */ 102 101 103 /** Checks if the specified variable type is of a pointer persuasion. */ 102 #define DBGCVAR_ISPOINTER(enmType) (enmType >= DBGCVAR_TYPE_GC_FLAT && enmType <= DBGCVAR_TYPE_HC_PHYS) 104 #define DBGCVAR_ISPOINTER(enmType) ((enmType) >= DBGCVAR_TYPE_GC_FLAT && enmType <= DBGCVAR_TYPE_HC_PHYS) 105 /** Checks if the specified variable type is of a pointer persuasion. */ 106 #define DBGCVAR_IS_FAR_PTR(enmType) ((enmType) == DBGCVAR_TYPE_GC_FAR || (enmType) == DBGCVAR_TYPE_HC_FAR) 103 107 /** Checks if the specified variable type is of a pointer persuasion and of the guest context sort. */ 104 #define DBGCVAR_ISGCPOINTER(enmType) ( enmType >= DBGCVAR_TYPE_GC_FLAT && enmType<= DBGCVAR_TYPE_GC_PHYS)108 #define DBGCVAR_ISGCPOINTER(enmType) ((enmType) >= DBGCVAR_TYPE_GC_FLAT && (enmType) <= DBGCVAR_TYPE_GC_PHYS) 105 109 /** Checks if the specified variable type is of a pointer persuasion and of the host context sort. */ 106 #define DBGCVAR_ISHCPOINTER(enmType) ( enmType >= DBGCVAR_TYPE_HC_FLAT && enmType<= DBGCVAR_TYPE_HC_PHYS)110 #define DBGCVAR_ISHCPOINTER(enmType) ((enmType) >= DBGCVAR_TYPE_HC_FLAT && (enmType) <= DBGCVAR_TYPE_HC_PHYS) 107 111 108 112 -
trunk/src/VBox/Debugger/DBGConsole.cpp
r4212 r4213 853 853 { {'!'}, 1, false, 1, dbgcOpBooleanNot, NULL, "Boolean not." }, 854 854 { {'~'}, 1, false, 1, dbgcOpBitwiseNot, NULL, "Bitwise complement." }, 855 { {' %'}, 1, false, 1, dbgcOpAddrFlat, NULL, "Flat address." },856 { {'%' ,'%'}, 2, false, 1, dbgcOpAddrPhys, NULL, "Physicaladdress." },857 { {' #'}, 1, false, 1, dbgcOpAddrHost, NULL, "Flat hostaddress." },858 { {'#' ,'%','%'}, 3, false, 1, dbgcOpAddrHostPhys, NULL, "Physicalhost address." },859 { {' $'}, 1, false, 1, dbgcOpVar, NULL, "Reference a variable." },860 { {' :'}, 1, true, 9, NULL, dbgcOpAddrFar, "Far pointer." },855 { {':'}, 1, true, 2, NULL, dbgcOpAddrFar, "Far pointer." }, 856 { {'%'}, 1, false, 3, dbgcOpAddrFlat, NULL, "Flat address." }, 857 { {'%','%'}, 2, false, 3, dbgcOpAddrPhys, NULL, "Physical address." }, 858 { {'#'}, 1, false, 3, dbgcOpAddrHost, NULL, "Flat host address." }, 859 { {'#','%','%'}, 3, false, 3, dbgcOpAddrHostPhys, NULL, "Physical host address." }, 860 { {'$'}, 1, false, 3, dbgcOpVar, NULL, "Reference a variable." }, 861 861 { {'*'}, 1, true, 10, NULL, dbgcOpMult, "Multiplication." }, 862 862 { {'/'}, 1, true, 11, NULL, dbgcOpDiv, "Division." }, … … 5140 5140 5141 5141 5142 5143 5142 /** 5144 5143 * Multiplication operator (binary). … … 5154 5153 static DECLCALLBACK(int) dbgcOpMult(PDBGC pDbgc, PCDBGCVAR pArg1, PCDBGCVAR pArg2, PDBGCVAR pResult) 5155 5154 { 5156 LogFlow(("dbgcOpMult\n")); 5157 NOREF(pDbgc); NOREF(pArg1); NOREF(pArg2); NOREF(pResult); 5158 return -1; 5155 // LogFlow(("dbgcOpMult\n")); 5156 int rc; 5157 5158 /* 5159 * Switch the factors so we preserve pointers, far pointers are considered more 5160 * important that physical and flat pointers. 5161 */ 5162 if ( DBGCVAR_ISPOINTER(pArg2->enmType) 5163 && ( !DBGCVAR_ISPOINTER(pArg1->enmType) 5164 || ( DBGCVAR_IS_FAR_PTR(pArg2->enmType) 5165 && !DBGCVAR_IS_FAR_PTR(pArg1->enmType)))) 5166 { 5167 PCDBGCVAR pTmp = pArg1; 5168 pArg2 = pArg1; 5169 pArg1 = pTmp; 5170 } 5171 5172 /* 5173 * Convert the 2nd number into a number we use multiply the first with. 5174 */ 5175 DBGCVAR Factor2 = *pArg2; 5176 if ( Factor2.enmType == DBGCVAR_TYPE_STRING 5177 || Factor2.enmType == DBGCVAR_TYPE_SYMBOL) 5178 { 5179 rc = dbgcSymbolGet(pDbgc, pArg2->u.pszString, DBGCVAR_TYPE_NUMBER, &Factor2); 5180 if (VBOX_FAILURE(rc)) 5181 return rc; 5182 } 5183 uint64_t u64Factor; 5184 switch (Factor2.enmType) 5185 { 5186 case DBGCVAR_TYPE_GC_FLAT: u64Factor = Factor2.u.GCFlat; break; 5187 case DBGCVAR_TYPE_GC_FAR: u64Factor = Factor2.u.GCFar.off; break; 5188 case DBGCVAR_TYPE_GC_PHYS: u64Factor = Factor2.u.GCPhys; break; 5189 case DBGCVAR_TYPE_HC_FLAT: u64Factor = (uintptr_t)Factor2.u.pvHCFlat; break; 5190 case DBGCVAR_TYPE_HC_FAR: u64Factor = Factor2.u.HCFar.off; break; 5191 case DBGCVAR_TYPE_HC_PHYS: u64Factor = Factor2.u.HCPhys; break; 5192 case DBGCVAR_TYPE_NUMBER: u64Factor = Factor2.u.u64Number; break; 5193 default: 5194 return VERR_PARSE_INCORRECT_ARG_TYPE; 5195 } 5196 5197 /* 5198 * Fix symbols in the 1st factor. 5199 */ 5200 *pResult = *pArg1; 5201 if ( pResult->enmType == DBGCVAR_TYPE_STRING 5202 || pResult->enmType == DBGCVAR_TYPE_SYMBOL) 5203 { 5204 rc = dbgcSymbolGet(pDbgc, pArg1->u.pszString, DBGCVAR_TYPE_ANY, pResult); 5205 if (VBOX_FAILURE(rc)) 5206 return rc; 5207 } 5208 5209 /* 5210 * Do the multiplication. 5211 */ 5212 switch (pArg1->enmType) 5213 { 5214 case DBGCVAR_TYPE_GC_FLAT: pResult->u.GCFlat *= u64Factor; break; 5215 case DBGCVAR_TYPE_GC_FAR: pResult->u.GCFar.off *= u64Factor; break; 5216 case DBGCVAR_TYPE_GC_PHYS: pResult->u.GCPhys *= u64Factor; break; 5217 case DBGCVAR_TYPE_HC_FLAT: 5218 pResult->u.pvHCFlat = (void *)(uintptr_t)((uintptr_t)pResult->u.pvHCFlat * u64Factor); 5219 break; 5220 case DBGCVAR_TYPE_HC_FAR: pResult->u.HCFar.off *= u64Factor; break; 5221 case DBGCVAR_TYPE_HC_PHYS: pResult->u.HCPhys *= u64Factor; break; 5222 case DBGCVAR_TYPE_NUMBER: pResult->u.u64Number *= u64Factor; break; 5223 default: 5224 return VERR_PARSE_INCORRECT_ARG_TYPE; 5225 } 5226 return 0; 5159 5227 } 5160 5228 … … 7603 7671 7604 7672 /** 7605 * Evaluates one argument with though ofunary operators.7673 * Evaluates one argument with respect to unary operators. 7606 7674 * 7607 7675 * @returns 0 on success. pResult contains the result. … … 7835 7903 char *pszOpSplit = NULL; 7836 7904 PCDBGCOP pOpSplit = NULL; 7837 unsigned iOpSplit = 0;7838 7905 unsigned cBinaryOps = 0; 7839 7906 unsigned cPar = 0; … … 7876 7943 * Update the parse state and skip the operator. 7877 7944 */ 7878 if (fBinary) 7945 if (!pOpSplit) 7946 { 7947 pOpSplit = pOp; 7948 pszOpSplit = psz; 7949 cBinaryOps = fBinary; 7950 } 7951 else if (fBinary) 7879 7952 { 7880 7953 cBinaryOps++; 7881 if ( iOpSplit < pOp->iPrecedence)7954 if (pOp->iPrecedence >= pOpSplit->iPrecedence) 7882 7955 { 7883 7956 pOpSplit = pOp; … … 7885 7958 } 7886 7959 } 7960 7887 7961 psz += pOp->cchName - 1; 7888 7962 fBinary = false; … … 7905 7979 */ 7906 7980 int rc; 7907 if (cBinaryOps) 7981 if ( cBinaryOps 7982 && pOpSplit->fBinary) 7908 7983 { 7909 7984 /* process 1st sub expression. */ … … 7921 7996 rc = pOpSplit->pfnHandlerBinary(pDbgc, &Arg1, &Arg2, pResult); 7922 7997 } 7998 } 7999 else if (cBinaryOps) 8000 { 8001 /* process sub expression. */ 8002 pszOpSplit += pOpSplit->cchName; 8003 DBGCVAR Arg; 8004 rc = dbgcEvalSub(pDbgc, pszOpSplit, cchExpr - (pszOpSplit - pszExpr), &Arg); 8005 if (VBOX_SUCCESS(rc)) 8006 /* apply the operator. */ 8007 rc = pOpSplit->pfnHandlerUnary(pDbgc, &Arg, pResult); 7923 8008 } 7924 8009 else
Note:
See TracChangeset
for help on using the changeset viewer.