- Timestamp:
- Jun 4, 2012 9:13:23 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dbg.h
r41565 r41573 109 109 /** Physical HC pointer. */ 110 110 DBGCVAR_TYPE_HC_PHYS, 111 /** Number. */ 112 DBGCVAR_TYPE_NUMBER, 111 113 /** String. */ 112 114 DBGCVAR_TYPE_STRING, 113 /** Number. */ 114 DBGCVAR_TYPE_NUMBER, 115 /** Symbol. 116 * @todo drop this */ 115 /** Symbol. */ 117 116 DBGCVAR_TYPE_SYMBOL, 118 117 /** Special type used when querying symbols. */ … … 322 321 323 322 /** 323 * Macro for initializing a DBGC variable with a symbol. 324 */ 325 #define DBGCVAR_INIT_SYMBOL(pVar, a_pszSymbol) \ 326 do { \ 327 DBGCVAR_INIT(pVar); \ 328 (pVar)->enmType = DBGCVAR_TYPE_SYMBOL; \ 329 (pVar)->enmRangeType = DBGCVAR_RANGE_BYTES; \ 330 (pVar)->u.pszString = (a_pszSymbol); \ 331 (pVar)->u64Range = strlen(a_pszSymbol); \ 332 } while (0) 333 334 335 /** 324 336 * Macro for setting the range of a DBGC variable. 325 337 * @param pVar The variable. -
trunk/include/VBox/err.h
r41561 r41573 2113 2113 /** Generic debugger command failure. */ 2114 2114 #define VERR_DBGC_COMMAND_FAILED (-5407) 2115 /** Logic bug in the DBGC code.. */ 2116 #define VERR_DBGC_IPE (-5408) 2115 2117 2116 2118 /** The lowest parse status code. */ -
trunk/src/VBox/Debugger/DBGCCmdHlp.cpp
r41571 r41573 50 50 51 51 return rc; 52 } 53 54 55 /** 56 * Outputs a string in quotes. 57 * 58 * @returns The number of bytes formatted. 59 * @param pfnOutput Pointer to output function. 60 * @param pvArgOutput Argument for the output function. 61 * @param chQuote The quote character. 62 * @param psz The string to quote. 63 * @param cch The string length. 64 */ 65 static size_t dbgcStringOutputInQuotes(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, char chQuote, const char *psz, size_t cch) 66 { 67 size_t cchOutput = pfnOutput(pvArgOutput, &chQuote, 1); 68 69 while (cch > 0) 70 { 71 char *pchQuote = (char *)memchr(psz, chQuote, cch); 72 if (!pchQuote) 73 { 74 cchOutput += pfnOutput(pvArgOutput, psz, cch); 75 break; 76 } 77 size_t cchSub = pchQuote - psz + 1; 78 cchOutput += pfnOutput(pvArgOutput, psz, cchSub); 79 cchOutput += pfnOutput(pvArgOutput, &chQuote, 1); 80 cchSub -= cchSub; 81 psz += cchSub; 82 } 83 84 cchOutput += pfnOutput(pvArgOutput, &chQuote, 1); 85 return cchOutput; 52 86 } 53 87 … … 103 137 case DBGCVAR_TYPE_HC_PHYS: 104 138 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "#%%%%%RHp", pVar->u.HCPhys); 105 case DBGCVAR_TYPE_STRING:106 return pfnOutput(pvArgOutput, pVar->u.pszString, (size_t)pVar->u64Range);107 139 case DBGCVAR_TYPE_NUMBER: 108 140 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%llx", pVar->u.u64Number); 141 case DBGCVAR_TYPE_STRING: 142 return dbgcStringOutputInQuotes(pfnOutput, pvArgOutput, '"', pVar->u.pszString, (size_t)pVar->u64Range); 143 case DBGCVAR_TYPE_SYMBOL: 144 return dbgcStringOutputInQuotes(pfnOutput, pvArgOutput, '\'', pVar->u.pszString, (size_t)pVar->u64Range); 109 145 110 146 case DBGCVAR_TYPE_UNKNOWN: … … 149 185 case DBGCVAR_TYPE_HC_PHYS: 150 186 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "#%%%%%RHp%s", pVar->u.HCPhys, szRange); 151 case DBGCVAR_TYPE_STRING:152 return pfnOutput(pvArgOutput, pVar->u.pszString, (size_t)pVar->u64Range);153 187 case DBGCVAR_TYPE_NUMBER: 154 188 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%llx%s", pVar->u.u64Number, szRange); 189 case DBGCVAR_TYPE_STRING: 190 return dbgcStringOutputInQuotes(pfnOutput, pvArgOutput, '"', pVar->u.pszString, (size_t)pVar->u64Range); 191 case DBGCVAR_TYPE_SYMBOL: 192 return dbgcStringOutputInQuotes(pfnOutput, pvArgOutput, '\'', pVar->u.pszString, (size_t)pVar->u64Range); 155 193 156 194 case DBGCVAR_TYPE_UNKNOWN: … … 710 748 return VINF_SUCCESS; 711 749 712 case DBGCVAR_TYPE_STRING:713 750 case DBGCVAR_TYPE_SYMBOL: 714 751 { … … 720 757 } 721 758 759 case DBGCVAR_TYPE_STRING: 722 760 case DBGCVAR_TYPE_HC_FLAT: 723 761 case DBGCVAR_TYPE_HC_PHYS: … … 793 831 break; 794 832 case DBGCVAR_TYPE_SYMBOL: 833 /** @todo try convert as symbol? */ 795 834 case DBGCVAR_TYPE_STRING: 796 835 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; /** @todo better error code! */ … … 813 852 switch (pVar->enmType) 814 853 { 854 case DBGCVAR_TYPE_SYMBOL: 815 855 case DBGCVAR_TYPE_STRING: 816 /** @todo add strcasecmp / stricmp wrappers to iprt/string.h. */ 817 if ( !strcmp(pVar->u.pszString, "true") 818 || !strcmp(pVar->u.pszString, "True") 819 || !strcmp(pVar->u.pszString, "TRUE") 820 || !strcmp(pVar->u.pszString, "on") 821 || !strcmp(pVar->u.pszString, "On") 822 || !strcmp(pVar->u.pszString, "oN") 823 || !strcmp(pVar->u.pszString, "ON") 824 || !strcmp(pVar->u.pszString, "enabled") 825 || !strcmp(pVar->u.pszString, "Enabled") 826 || !strcmp(pVar->u.pszString, "DISABLED")) 856 if ( !RTStrICmp(pVar->u.pszString, "true") 857 || !RTStrICmp(pVar->u.pszString, "on") 858 || !RTStrICmp(pVar->u.pszString, "no") 859 || !RTStrICmp(pVar->u.pszString, "enabled")) 827 860 { 828 861 *pf = true; 829 862 return VINF_SUCCESS; 830 863 } 831 if ( !strcmp(pVar->u.pszString, "false") 832 || !strcmp(pVar->u.pszString, "False") 833 || !strcmp(pVar->u.pszString, "FALSE") 834 || !strcmp(pVar->u.pszString, "off") 835 || !strcmp(pVar->u.pszString, "Off") 836 || !strcmp(pVar->u.pszString, "OFF") 837 || !strcmp(pVar->u.pszString, "disabled") 838 || !strcmp(pVar->u.pszString, "Disabled") 839 || !strcmp(pVar->u.pszString, "DISABLED")) 864 if ( !RTStrICmp(pVar->u.pszString, "false") 865 || !RTStrICmp(pVar->u.pszString, "off") 866 || !RTStrICmp(pVar->u.pszString, "yes") 867 || !RTStrICmp(pVar->u.pszString, "disabled")) 840 868 { 841 869 *pf = false; … … 853 881 854 882 case DBGCVAR_TYPE_GC_FAR: 855 case DBGCVAR_TYPE_SYMBOL:856 883 default: 857 884 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; -
trunk/src/VBox/Debugger/DBGCCommands.cpp
r41571 r41573 206 206 { 207 207 /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */ 208 { 1, 1, DBGCVAR_CAT_S TRING, 0, "var", "Variable name." },208 { 1, 1, DBGCVAR_CAT_SYMBOL, 0, "var", "Variable name." }, 209 209 { 1, 1, DBGCVAR_CAT_ANY, 0, "value", "Value to assign to the variable." }, 210 210 }; 211 211 212 /** 'unset' arguments */ 213 static const DBGCVARDESC g_aArgUnset[] = 214 { 215 /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */ 216 { 1, ~0U, DBGCVAR_CAT_SYMBOL, 0, "vars", "One or more variable names." }, 217 }; 212 218 213 219 /** writecore arguments. */ … … 257 263 { "stop", 0, 0, NULL, 0, 0, dbgcCmdStop, "", "Stop execution." }, 258 264 { "unloadplugin", 1, ~0U, &g_aArgPlugIn[0], RT_ELEMENTS(g_aArgPlugIn), 0, dbgcCmdUnloadPlugIn, "<plugin1> [plugin2..N]", "Unloads one or more plugins." }, 259 { "unset", 1, ~0U, &g_aArg MultiStr[0], RT_ELEMENTS(g_aArgMultiStr),0, dbgcCmdUnset, "<var1> [var1..[varN]]", "Unsets (delete) one or more global variables." },265 { "unset", 1, ~0U, &g_aArgUnset[0], RT_ELEMENTS(g_aArgUnset), 0, dbgcCmdUnset, "<var1> [var1..[varN]]", "Unsets (delete) one or more global variables." }, 260 266 { "writecore", 1, 1, &g_aArgWriteCore[0], RT_ELEMENTS(g_aArgWriteCore), 0, dbgcCmdWriteCore, "<filename>", "Write core to file." }, 261 267 }; … … 476 482 unsigned i; 477 483 484 /** @todo rewrite this. */ 478 485 if (!cArgs) 479 486 { … … 548 555 for (unsigned iArg = 0; iArg < cArgs; iArg++) 549 556 { 550 Assert (paArgs[iArg].enmType == DBGCVAR_TYPE_STRING);557 AssertReturn(paArgs[iArg].enmType == DBGCVAR_TYPE_STRING, VERR_DBGC_PARSE_BUG); 551 558 const char *pszPattern = paArgs[iArg].u.pszString; 552 559 bool fFound = false; … … 687 694 for (unsigned i = 0; i < cArgs; i++) 688 695 { 689 if (paArgs[i].enmType == DBGCVAR_TYPE_STRING) 690 rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, i ? " %s" : "%s", paArgs[i].u.pszString); 691 else 692 rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, i ? " <parser error>" : "<parser error>"); 696 AssertReturn(paArgs[i].enmType == DBGCVAR_TYPE_STRING, VERR_DBGC_PARSE_BUG); 697 rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, i ? " %s" : "%s", paArgs[i].u.pszString); 693 698 if (RT_FAILURE(rc)) 694 699 return rc; … … 1469 1474 { 1470 1475 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 1471 1472 /*1473 * Don't trust the parser.1474 */1475 1476 for (unsigned i = 0; i < cArgs; i++) 1476 if (paArgs[i].enmType != DBGCVAR_TYPE_STRING) 1477 { 1478 AssertMsgFailed(("expected strings only. (arg=%d)!\n", i)); 1479 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; 1480 } 1477 AssertReturn(paArgs[i].enmType == DBGCVAR_TYPE_SYMBOL, VERR_DBGC_PARSE_BUG); 1481 1478 1482 1479 /* -
trunk/src/VBox/Debugger/DBGCEval.cpp
r41572 r41573 46 46 * Internal Functions * 47 47 *******************************************************************************/ 48 static int dbgcCheckAndTypePromoteArgument(PDBGC pDbgc, DBGCVARCAT enmCategory, PDBGCVAR pArg); 48 49 static int dbgcProcessArguments(PDBGC pDbgc, const char *pszCmdOrFunc, 49 50 uint32_t const cArgsMin, uint32_t const cArgsMax, … … 166 167 pArg->pDesc = NULL; 167 168 pArg->pNext = NULL; 168 pArg->enmType = chQuote == ' \'' ? DBGCVAR_TYPE_SYMBOL : DBGCVAR_TYPE_STRING;169 pArg->enmType = chQuote == '"' ? DBGCVAR_TYPE_STRING : DBGCVAR_TYPE_SYMBOL; 169 170 pArg->u.pszString = pszCopy; 170 171 pArg->enmRangeType = DBGCVAR_RANGE_BYTES; … … 486 487 else 487 488 rc = dbgcEvalSubUnary(pDbgc, pszExpr2, cchExpr - (pszExpr2 - pszExpr), pOp->enmCatArg1, &Arg); 489 if (RT_SUCCESS(rc)) 490 rc = dbgcCheckAndTypePromoteArgument(pDbgc, pOp->enmCatArg1, &Arg); 488 491 if (RT_SUCCESS(rc)) 489 492 rc = pOp->pfnHandlerUnary(pDbgc, &Arg, enmCategory, pResult); … … 751 754 752 755 /* 753 * Either we found an operator to divide the expression by 754 * or we didn't find any. In the first case it's divide and755 * conquer. In the latter it's a single expression which756 * needs dealing with its unary operatorsif any.756 * Either we found an operator to divide the expression by or we didn't 757 * find any. In the first case it's divide and conquer. In the latter 758 * it's a single expression which needs dealing with its unary operators 759 * if any. 757 760 */ 758 761 int rc; … … 771 774 rc = dbgcEvalSub(pDbgc, psz2, cchExpr - (psz2 - pszExpr), pOpSplit->enmCatArg2, &Arg2); 772 775 if (RT_SUCCESS(rc)) 773 /* apply the operator. */ 776 rc = dbgcCheckAndTypePromoteArgument(pDbgc, pOpSplit->enmCatArg1, &Arg1); 777 if (RT_SUCCESS(rc)) 778 rc = dbgcCheckAndTypePromoteArgument(pDbgc, pOpSplit->enmCatArg2, &Arg2); 779 if (RT_SUCCESS(rc)) 774 780 rc = pOpSplit->pfnHandlerBinary(pDbgc, &Arg1, &Arg2, pResult); 775 781 } … … 782 788 rc = dbgcEvalSub(pDbgc, pszOpSplit, cchExpr - (pszOpSplit - pszExpr), pOpSplit->enmCatArg1, &Arg); 783 789 if (RT_SUCCESS(rc)) 784 /* apply the operator. */ 790 rc = dbgcCheckAndTypePromoteArgument(pDbgc, pOpSplit->enmCatArg1, &Arg); 791 if (RT_SUCCESS(rc)) 785 792 rc = pOpSplit->pfnHandlerUnary(pDbgc, &Arg, enmCategory, pResult); 786 793 } … … 1309 1316 * @param cchCmd Length of the command. 1310 1317 * @param fNoExecute Indicates that no commands should actually be executed. 1311 *1312 * @todo Change pszCmd into argc/argv?1313 1318 */ 1314 1319 int dbgcEvalCommand(PDBGC pDbgc, char *pszCmd, size_t cchCmd, bool fNoExecute) … … 1331 1336 */ 1332 1337 char *pszArgs = pszCmd; 1333 while (RT_C_IS_ALNUM(*pszArgs) )1338 while (RT_C_IS_ALNUM(*pszArgs) || *pszArgs == '_') 1334 1339 pszArgs++; 1335 if (*pszArgs && (!RT_C_IS_BLANK(*pszArgs) || pszArgs == pszCmd)) 1340 if ( (*pszArgs && !RT_C_IS_BLANK(*pszArgs)) 1341 || !RT_C_IS_ALPHA(*pszCmd)) 1336 1342 { 1337 1343 DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "Syntax error: Invalid command '%s'!\n", pszCmdInput); -
trunk/src/VBox/Debugger/DBGCOps.cpp
r41561 r41573 81 81 do \ 82 82 { \ 83 if ((pArg1)->enmType == DBGCVAR_TYPE_STRING) \ 84 return VERR_DBGC_PARSE_INVALID_OPERATION; \ 85 \ 83 86 /* Get the 64-bit right side value. */ \ 84 87 uint64_t u64Right; \ … … 89 92 { \ 90 93 /* Apply it to the left hand side. */ \ 91 if ( (pArg1)->enmType == DBGCVAR_TYPE_SYMBOL \ 92 || (pArg1)->enmType == DBGCVAR_TYPE_STRING) \ 94 if ((pArg1)->enmType == DBGCVAR_TYPE_SYMBOL) \ 93 95 { \ 94 96 rc = dbgcSymbolGet((pDbgc), (pArg1)->u.pszString, DBGCVAR_TYPE_ANY, (pResult)); \ … … 165 167 { {'#'}, 1, false, 3, dbgcOpAddrHost, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Flat host address." }, 166 168 { {'#','%','%'}, 3, false, 3, dbgcOpAddrHostPhys, NULL, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Physical host address." }, 167 { {'$'}, 1, false, 3, dbgcOpVar, NULL, DBGCVAR_CAT_S TRING, DBGCVAR_CAT_ANY, "Reference a variable." },168 { {'@'}, 1, false, 3, dbgcOpRegister, NULL, DBGCVAR_CAT_S TRING, DBGCVAR_CAT_ANY, "Reference a register." },169 { {'$'}, 1, false, 3, dbgcOpVar, NULL, DBGCVAR_CAT_SYMBOL, DBGCVAR_CAT_ANY, "Reference a variable." }, 170 { {'@'}, 1, false, 3, dbgcOpRegister, NULL, DBGCVAR_CAT_SYMBOL, DBGCVAR_CAT_ANY, "Reference a register." }, 169 171 { {'*'}, 1, true, 10, NULL, dbgcOpMult, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Multiplication." }, 170 172 { {'/'}, 1, true, 11, NULL, dbgcOpDiv, DBGCVAR_CAT_ANY, DBGCVAR_CAT_ANY, "Division." }, … … 216 218 *pu64Ret = Var.u.HCPhys; 217 219 break; 218 case DBGCVAR_TYPE_STRING: 220 case DBGCVAR_TYPE_NUMBER: 221 *pu64Ret = Var.u.u64Number; 222 break; 219 223 case DBGCVAR_TYPE_SYMBOL: 220 224 { … … 224 228 /* fall thru */ 225 229 } 226 case DBGCVAR_TYPE_NUMBER: 227 *pu64Ret = Var.u.u64Number; 228 break; 230 case DBGCVAR_TYPE_STRING: 229 231 default: 230 232 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; … … 269 271 break; 270 272 271 case DBGCVAR_TYPE_UNKNOWN:272 273 case DBGCVAR_TYPE_STRING: 274 case DBGCVAR_TYPE_SYMBOL: 273 275 default: 274 276 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; … … 303 305 break; 304 306 305 case DBGCVAR_TYPE_UNKNOWN:306 307 case DBGCVAR_TYPE_STRING: 308 case DBGCVAR_TYPE_SYMBOL: 307 309 default: 308 310 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; … … 348 350 break; 349 351 case DBGCVAR_TYPE_STRING: 352 case DBGCVAR_TYPE_SYMBOL: 350 353 pResult->u.u64Number = !pResult->u64Range; 351 354 break; … … 396 399 break; 397 400 398 case DBGCVAR_TYPE_UNKNOWN:399 401 case DBGCVAR_TYPE_STRING: 402 case DBGCVAR_TYPE_SYMBOL: 400 403 default: 401 404 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; … … 419 422 { 420 423 LogFlow(("dbgcOpVar: %s\n", pArg->u.pszString)); 421 422 /* 423 * Parse sanity. 424 */ 425 if (pArg->enmType != DBGCVAR_TYPE_STRING) 426 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; 424 AssertReturn(pArg->enmType == DBGCVAR_TYPE_SYMBOL, VERR_DBGC_PARSE_BUG); 427 425 428 426 /* … … 456 454 { 457 455 LogFlow(("dbgcOpRegister: %s\n", pArg->u.pszString)); 458 459 /* 460 * Parse sanity. 461 */ 462 if ( pArg->enmType != DBGCVAR_TYPE_STRING 463 && pArg->enmType != DBGCVAR_TYPE_SYMBOL) 464 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; 456 AssertReturn(pArg->enmType == DBGCVAR_TYPE_SYMBOL, VERR_DBGC_PARSE_BUG); 465 457 466 458 /* … … 616 608 switch (pArg1->enmType) 617 609 { 618 case DBGCVAR_TYPE_S TRING:610 case DBGCVAR_TYPE_SYMBOL: 619 611 rc = dbgcSymbolGet(pDbgc, pArg1->u.pszString, DBGCVAR_TYPE_NUMBER, pResult); 620 612 if (RT_FAILURE(rc)) … … 624 616 *pResult = *pArg1; 625 617 break; 626 627 case DBGCVAR_TYPE_GC_FLAT:628 case DBGCVAR_TYPE_GC_FAR:629 case DBGCVAR_TYPE_GC_PHYS:630 case DBGCVAR_TYPE_HC_FLAT:631 case DBGCVAR_TYPE_HC_PHYS:632 case DBGCVAR_TYPE_UNKNOWN:633 618 default: 634 619 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; … … 654 639 break; 655 640 656 case DBGCVAR_TYPE_S TRING:641 case DBGCVAR_TYPE_SYMBOL: 657 642 { 658 643 DBGCVAR Var; … … 665 650 } 666 651 667 case DBGCVAR_TYPE_GC_FAR:668 case DBGCVAR_TYPE_GC_PHYS:669 case DBGCVAR_TYPE_HC_PHYS:670 case DBGCVAR_TYPE_UNKNOWN:671 652 default: 672 653 return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE; … … 750 731 * An addition operation will return (when possible) the left side type in the 751 732 * expression. We make an omission for numbers, where we'll take the right side 752 * type instead. An expression where only the left hand side is a s tringwe'll753 * use the right hand type assuming that the string is a symbol.733 * type instead. An expression where only the left hand side is a symbol we'll 734 * use the right hand type to try resolve it. 754 735 */ 755 if ( (pArg1->enmType == DBGCVAR_TYPE_NUMBER && pArg2->enmType != DBGCVAR_TYPE_STRING) 756 || (pArg1->enmType == DBGCVAR_TYPE_STRING && pArg2->enmType != DBGCVAR_TYPE_STRING)) 736 if ( pArg1->enmType == DBGCVAR_TYPE_STRING 737 || pArg2->enmType == DBGCVAR_TYPE_STRING) 738 return VERR_DBGC_PARSE_INVALID_OPERATION; /** @todo string contactenation later. */ 739 740 if ( (pArg1->enmType == DBGCVAR_TYPE_NUMBER && pArg2->enmType != DBGCVAR_TYPE_SYMBOL) 741 || (pArg1->enmType == DBGCVAR_TYPE_SYMBOL && pArg2->enmType != DBGCVAR_TYPE_SYMBOL)) 757 742 { 758 743 PCDBGCVAR pTmp = pArg2; … … 760 745 pArg1 = pTmp; 761 746 } 747 762 748 DBGCVAR Sym1, Sym2; 763 if (pArg1->enmType == DBGCVAR_TYPE_S TRING)749 if (pArg1->enmType == DBGCVAR_TYPE_SYMBOL) 764 750 { 765 751 int rc = dbgcSymbolGet(pDbgc, pArg1->u.pszString, DBGCVAR_TYPE_ANY, &Sym1); … … 877 863 { 878 864 case DBGCVAR_TYPE_SYMBOL: 879 case DBGCVAR_TYPE_STRING:880 865 rc = dbgcSymbolGet(pDbgc, pArg2->u.pszString, DBGCVAR_TYPE_NUMBER, &Var); 881 866 if (RT_FAILURE(rc)) … … 916 901 * However, if the left hand side is a number and the right hand a pointer of 917 902 * some kind we'll convert the left hand side to the same type as the right hand. 918 * Any s trings will be attempted resolved as symbols.903 * Any symbols will be resolved, strings will be rejected. 919 904 */ 920 905 DBGCVAR Sym1, Sym2; 921 if ( pArg2->enmType == DBGCVAR_TYPE_S TRING906 if ( pArg2->enmType == DBGCVAR_TYPE_SYMBOL 922 907 && ( pArg1->enmType == DBGCVAR_TYPE_NUMBER 923 || pArg1->enmType == DBGCVAR_TYPE_S TRING))908 || pArg1->enmType == DBGCVAR_TYPE_SYMBOL)) 924 909 { 925 910 int rc = dbgcSymbolGet(pDbgc, pArg2->u.pszString, DBGCVAR_TYPE_ANY, &Sym2); … … 929 914 } 930 915 931 if (pArg1->enmType == DBGCVAR_TYPE_STRING) 916 if ( pArg1->enmType == DBGCVAR_TYPE_STRING 917 || pArg2->enmType == DBGCVAR_TYPE_STRING) 918 return VERR_DBGC_PARSE_INVALID_OPERATION; 919 920 if (pArg1->enmType == DBGCVAR_TYPE_SYMBOL) 932 921 { 933 922 DBGCVARTYPE enmType; … … 946 935 enmType = DBGCVAR_TYPE_GC_FLAT; 947 936 break; 948 949 default: 950 case DBGCVAR_TYPE_STRING: 951 AssertMsgFailed(("Can't happen\n")); 952 enmType = DBGCVAR_TYPE_STRING; 953 break; 937 default: AssertFailedReturn(VERR_DBGC_IPE); 954 938 } 955 939 if (enmType != DBGCVAR_TYPE_STRING) … … 981 965 case DBGCVAR_TYPE_NUMBER: 982 966 break; 983 default: 984 case DBGCVAR_TYPE_STRING: 985 AssertMsgFailed(("Can't happen\n")); 986 break; 967 default: AssertFailedReturn(VERR_DBGC_IPE); 987 968 } 988 969 if (pOp) … … 994 975 } 995 976 } 996 997 977 998 978 /* … … 1102 1082 { 1103 1083 case DBGCVAR_TYPE_SYMBOL: 1104 case DBGCVAR_TYPE_STRING:1105 1084 rc = dbgcSymbolGet(pDbgc, pArg2->u.pszString, DBGCVAR_TYPE_NUMBER, &Var); 1106 1085 if (RT_FAILURE(rc)) … … 1268 1247 LogFlow(("dbgcOpRangeLength\n")); 1269 1248 1249 if (pArg1->enmType == DBGCVAR_TYPE_STRING) 1250 return VERR_DBGC_PARSE_INVALID_OPERATION; 1251 1270 1252 /* 1271 * Make result. S trings needs to be resolved into symbols.1253 * Make result. Symbols needs to be resolved. 1272 1254 */ 1273 if (pArg1->enmType == DBGCVAR_TYPE_S TRING)1255 if (pArg1->enmType == DBGCVAR_TYPE_SYMBOL) 1274 1256 { 1275 1257 int rc = dbgcSymbolGet(pDbgc, pArg1->u.pszString, DBGCVAR_TYPE_ANY, pResult); … … 1290 1272 break; 1291 1273 1292 case DBGCVAR_TYPE_S TRING:1274 case DBGCVAR_TYPE_SYMBOL: 1293 1275 { 1294 1276 int rc = dbgcSymbolGet(pDbgc, pArg2->u.pszString, DBGCVAR_TYPE_NUMBER, pResult); … … 1299 1281 } 1300 1282 1283 case DBGCVAR_TYPE_STRING: 1301 1284 default: 1302 1285 return VERR_DBGC_PARSE_INVALID_OPERATION; … … 1376 1359 case DBGCVAR_TYPE_GC_FAR: 1377 1360 case DBGCVAR_TYPE_STRING: 1361 case DBGCVAR_TYPE_SYMBOL: 1378 1362 default: 1379 1363 AssertMsgFailed(("Impossible!\n")); -
trunk/src/VBox/Debugger/DBGConsole.cpp
r41572 r41573 243 243 { 244 244 DBGCVAR Var; 245 DBGCVAR_INIT_S TRING(&Var, pszSymbol);245 DBGCVAR_INIT_SYMBOL(&Var, pszSymbol); 246 246 rc = dbgcOpRegister(pDbgc, &Var, DBGCVAR_CAT_ANY, pResult); 247 247 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.