Changeset 35632 in vbox
- Timestamp:
- Jan 19, 2011 3:55:05 PM (14 years ago)
- Location:
- trunk/src/VBox/Debugger
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCCmdHlp.cpp
r35628 r35632 694 694 if (RT_FAILURE(pDbgc->rcOutput)) 695 695 return pDbgc->rcOutput; 696 697 /** @todo DBGC: Implement failure / success on command level. */ 698 return VINF_SUCCESS; 696 return VERR_DBGC_COMMAND_FAILED; 699 697 } 700 698 -
trunk/src/VBox/Debugger/DBGCCmdWorkers.cpp
r35628 r35632 375 375 * @returns VERR_DBGC_BP_NOT_FOUND if the breakpoint wasn't found. 376 376 * @returns VERR_BUFFER_OVERFLOW if the is not enough space in the scratch buffer for the command. 377 * @returns VBox status code from dbgcEvalCommand() other 377 * @returns VBox status code from dbgcEvalCommand() otherwise. 378 378 * @param pDbgc The DBGC instance. 379 379 * @param iBp The breakpoint to execute. -
trunk/src/VBox/Debugger/DBGCEval.cpp
r35628 r35632 93 93 94 94 NOREF(pDbgc); 95 return 0;95 return VINF_SUCCESS; 96 96 } 97 97 … … 136 136 pArg->u64Range = 0; 137 137 138 return 0;138 return VINF_SUCCESS; 139 139 } 140 140 … … 356 356 * - Number to a pointer. 357 357 * - Pointer to a number. 358 * @returns 0 on success with paVars.359 * @returns VBox error code for match errors.358 * 359 * @returns VBox status code. Modified @a paVars on success. 360 360 */ 361 361 static int dbgcEvalSubMatchVars(PDBGC pDbgc, unsigned cVarsMin, unsigned cVarsMax, … … 432 432 } 433 433 434 return 0;434 return VINF_SUCCESS; 435 435 } 436 436 … … 439 439 * Evaluates one argument with respect to unary operators. 440 440 * 441 * @returns 0 on success. pResult contains the result. 442 * @returns VBox error code on parse or other evaluation error. 441 * @returns VBox status code. pResult contains the result on success. 443 442 * 444 443 * @param pDbgc Debugger console instance data. … … 458 457 * ASSUME: unary operators are all of equal precedence. 459 458 */ 460 int rc = 0;459 int rc = VINF_SUCCESS; 461 460 PCDBGCOP pOp = dbgcOperatorLookup(pDbgc, pszExpr, false, ' '); 462 461 if (pOp) … … 587 586 * Evaluates one argument. 588 587 * 589 * @returns 0 on success. pResult contains the result. 590 * @returns VBox error code on parse or other evaluation error. 588 * @returns VBox status code. 591 589 * 592 590 * @param pDbgc Debugger console instance data. … … 787 785 * Parses the arguments of one command. 788 786 * 789 * @returns 0 on success. 790 * @returns VBox error code on parse error with *pcArg containing the argument causing trouble. 787 * @returns VBox statuc code. On parser errors the index of the troublesome 788 * argument is indicated by *pcArg. 789 * 791 790 * @param pDbgc Debugger console instance data. 792 791 * @param pCmd Pointer to the command descriptor. … … 794 793 * @param paArgs Where to store the parsed arguments. 795 794 * @param cArgs Size of the paArgs array. 796 * @param pcArgs Where to store the number of arguments. 797 * In the event of an error this is used to store the index of the offending argument. 795 * @param pcArgs Where to store the number of arguments. In the event 796 * of an error this is (ab)used to store the index of the 797 * offending argument. 798 798 */ 799 799 static int dbgcProcessArguments(PDBGC pDbgc, PCDBGCCMD pCmd, char *pszArgs, PDBGCVAR paArgs, unsigned cArgs, unsigned *pcArgs) 800 800 { 801 801 Log2(("dbgcProcessArguments: pCmd=%s pszArgs='%s'\n", pCmd->pszCmd, pszArgs)); 802 802 803 /* 803 804 * Check if we have any argument and if the command takes any. … … 810 811 { 811 812 if (!pCmd->cArgsMin) 812 return 0;813 return VINF_SUCCESS; 813 814 return VERR_PARSE_TOO_FEW_ARGUMENTS; 814 815 } … … 985 986 * Evaluate one command. 986 987 * 987 * @returns VBox status code. Any error indicates the termination of the console session.988 * @returns VBox status code. This is also stored in DBGC::rcCmd. 988 989 * 989 990 * @param pDbgc Debugger console instance data. … … 991 992 * @param cchCmd Length of the command. 992 993 * @param fNoExecute Indicates that no commands should actually be executed. 994 * 993 995 * @todo Change pszCmd into argc/argv? 994 996 */ … … 1004 1006 1005 1007 /* external command? */ 1006 bool fExternal = *pszCmd == '.';1008 bool const fExternal = *pszCmd == '.'; 1007 1009 if (fExternal) 1008 1010 pszCmd++, cchCmd--; … … 1016 1018 if (*pszArgs && (!RT_C_IS_BLANK(*pszArgs) || pszArgs == pszCmd)) 1017 1019 { 1018 pDbgc->rcCmd = VINF_PARSE_INVALD_COMMAND_NAME; 1019 pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL, "Syntax error in command '%s'!\n", pszCmdInput); 1020 return 0; 1020 DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "Syntax error: Invalid command '%s'!\n", pszCmdInput); 1021 return pDbgc->rcCmd = VINF_PARSE_INVALD_COMMAND_NAME; 1021 1022 } 1022 1023 … … 1027 1028 if (!pCmd || (pCmd->fFlags & DBGCCMD_FLAGS_FUNCTION)) 1028 1029 { 1029 pDbgc->rcCmd = VINF_PARSE_COMMAND_NOT_FOUND;1030 return pDbgc-> CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL, "Unknown command '%s'!\n", pszCmdInput);1030 DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "Syntax error: Unknown command '%s'!\n", pszCmdInput); 1031 return pDbgc->rcCmd = VINF_PARSE_COMMAND_NOT_FOUND; 1031 1032 } 1032 1033 … … 1036 1037 unsigned cArgs; 1037 1038 int rc = dbgcProcessArguments(pDbgc, pCmd, pszArgs, &pDbgc->aArgs[pDbgc->iArg], RT_ELEMENTS(pDbgc->aArgs) - pDbgc->iArg, &cArgs); 1038 1039 /* 1040 * Execute the command. 1041 */ 1042 if (!rc) 1043 { 1039 if (RT_SUCCESS(rc)) 1040 { 1041 AssertMsg(rc == VINF_SUCCESS, ("%Rrc\n", rc)); 1042 1043 /* 1044 * Execute the command. 1045 */ 1044 1046 if (!fNoExecute) 1045 1047 rc = pCmd->pfnHandler(pCmd, &pDbgc->CmdHlp, pDbgc->pVM, &pDbgc->aArgs[0], cArgs, NULL); … … 1056 1058 { 1057 1059 case VERR_PARSE_TOO_FEW_ARGUMENTS: 1058 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1060 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1059 1061 "Syntax error: Too few arguments. Minimum is %d for command '%s'.\n", pCmd->cArgsMin, pCmd->pszCmd); 1060 1062 break; 1061 1063 case VERR_PARSE_TOO_MANY_ARGUMENTS: 1062 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1064 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1063 1065 "Syntax error: Too many arguments. Maximum is %d for command '%s'.\n", pCmd->cArgsMax, pCmd->pszCmd); 1064 1066 break; 1065 1067 case VERR_PARSE_ARGUMENT_OVERFLOW: 1066 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1068 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1067 1069 "Syntax error: Too many arguments.\n"); 1068 1070 break; 1069 1071 case VERR_PARSE_UNBALANCED_QUOTE: 1070 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1072 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1071 1073 "Syntax error: Unbalanced quote (argument %d).\n", cArgs); 1072 1074 break; 1073 1075 case VERR_PARSE_UNBALANCED_PARENTHESIS: 1074 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1076 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1075 1077 "Syntax error: Unbalanced parenthesis (argument %d).\n", cArgs); 1076 1078 break; 1077 1079 case VERR_PARSE_EMPTY_ARGUMENT: 1078 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1080 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1079 1081 "Syntax error: An argument or subargument contains nothing useful (argument %d).\n", cArgs); 1080 1082 break; 1081 1083 case VERR_PARSE_UNEXPECTED_OPERATOR: 1082 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1084 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1083 1085 "Syntax error: Invalid operator usage (argument %d).\n", cArgs); 1084 1086 break; 1085 1087 case VERR_PARSE_INVALID_NUMBER: 1086 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1088 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1087 1089 "Syntax error: Ivalid numeric value (argument %d). If a string was the intention, then quote it.\n", cArgs); 1088 1090 break; 1089 1091 case VERR_PARSE_NUMBER_TOO_BIG: 1090 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1092 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1091 1093 "Error: Numeric overflow (argument %d).\n", cArgs); 1092 1094 break; 1093 1095 case VERR_PARSE_INVALID_OPERATION: 1094 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1096 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1095 1097 "Error: Invalid operation attempted (argument %d).\n", cArgs); 1096 1098 break; 1097 1099 case VERR_PARSE_FUNCTION_NOT_FOUND: 1098 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1100 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1099 1101 "Error: Function not found (argument %d).\n", cArgs); 1100 1102 break; 1101 1103 case VERR_PARSE_NOT_A_FUNCTION: 1102 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1104 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1103 1105 "Error: The function specified is not a function (argument %d).\n", cArgs); 1104 1106 break; 1105 1107 case VERR_PARSE_NO_MEMORY: 1106 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1108 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1107 1109 "Error: Out memory in the regular heap! Expect odd stuff to happen...\n", cArgs); 1108 1110 break; 1109 1111 case VERR_PARSE_INCORRECT_ARG_TYPE: 1110 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1112 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1111 1113 "Error: Incorrect argument type (argument %d?).\n", cArgs); 1112 1114 break; 1113 1115 case VERR_PARSE_VARIABLE_NOT_FOUND: 1114 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1116 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1115 1117 "Error: An undefined variable was referenced (argument %d).\n", cArgs); 1116 1118 break; 1117 1119 case VERR_PARSE_CONVERSION_FAILED: 1118 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1120 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1119 1121 "Error: A conversion between two types failed (argument %d).\n", cArgs); 1120 1122 break; 1121 1123 case VERR_PARSE_NOT_IMPLEMENTED: 1122 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1124 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1123 1125 "Error: You hit a debugger feature which isn't implemented yet (argument %d).\n", cArgs); 1124 1126 break; 1125 1127 case VERR_PARSE_BAD_RESULT_TYPE: 1126 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1128 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1127 1129 "Error: Couldn't satisfy a request for a specific result type (argument %d). (Usually applies to symbols)\n", cArgs); 1128 1130 break; 1129 1131 case VERR_PARSE_WRITEONLY_SYMBOL: 1130 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL,1132 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, 1131 1133 "Error: Cannot get symbol, it's set only (argument %d).\n", cArgs); 1132 1134 break; 1133 1135 1134 1136 case VERR_DBGC_COMMAND_FAILED: 1135 rc = VINF_SUCCESS;1136 1137 break; 1137 1138 1138 1139 default: 1139 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL, 1140 "Error: Unknown error %d!\n", rc); 1141 return rc; 1140 rc = DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "Error: Unknown error %d!\n", rc); 1141 break; 1142 1142 } 1143 1144 /* 1145 * Parse errors are non fatal. 1146 */ 1147 if (rc >= VERR_PARSE_FIRST && rc < VERR_PARSE_LAST) 1148 rc = VINF_SUCCESS; 1149 } 1150 1143 } 1151 1144 return rc; 1152 1145 } -
trunk/src/VBox/Debugger/DBGConsole.cpp
r35629 r35632 340 340 pDbgc->iArg = 0; 341 341 rc = dbgcEvalCommand(pDbgc, &pDbgc->achScratch[0], psz - &pDbgc->achScratch[0] - 1, fNoExecute); 342 if (rc) 342 if ( rc == VERR_DBGC_QUIT 343 || rc == VWRN_DBGC_CMD_PENDING) 343 344 break; 344 345 }
Note:
See TracChangeset
for help on using the changeset viewer.