- Timestamp:
- Jun 16, 2015 11:46:25 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r56422 r56466 156 156 { "extpack", USAGE_EXTPACK, HELP_CMD_EXTPACK, handleExtPack, 0 }, 157 157 { "bandwidthctl", USAGE_BANDWIDTHCONTROL, VBMG_CMD_TODO, handleBandwidthControl, 0 }, 158 { "debugvm", USAGE_DEBUGVM, VBMG_CMD_TODO, handleDebugVM, 0 },158 { "debugvm", USAGE_DEBUGVM, HELP_CMD_DEBUGVM, handleDebugVM, 0 }, 159 159 { "convertfromraw", USAGE_CONVERTFROMRAW, VBMG_CMD_TODO, handleConvertFromRaw, VBMG_CMD_F_NO_COM }, 160 160 { "convertdd", USAGE_CONVERTFROMRAW, VBMG_CMD_TODO, handleConvertFromRaw, VBMG_CMD_F_NO_COM }, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
r56119 r56466 106 106 107 107 default: 108 return errorGetOpt( USAGE_DEBUGVM,rc, &ValueUnion);108 return errorGetOpt(rc, &ValueUnion); 109 109 } 110 110 } 111 111 112 112 if (!cRegisters) 113 return errorSyntax( USAGE_DEBUGVM,"The getregisters sub-command takes at least one register name");113 return errorSyntax("The getregisters sub-command takes at least one register name"); 114 114 return RTEXITCODE_SUCCESS; 115 115 } … … 119 119 * 120 120 * @returns Suitable exit code. 121 * @param a The handler arguments. 122 * @param pDebugger Pointer to the debugger interface. 123 */ 124 static RTEXITCODE handleDebugVM_Info(HandlerArg *a, IMachineDebugger *pDebugger) 125 { 126 if (a->argc < 3 || a->argc > 4) 127 return errorSyntax(USAGE_DEBUGVM, "The inject sub-command takes at one or two arguments"); 128 129 com::Bstr bstrName(a->argv[2]); 130 com::Bstr bstrArgs(a->argv[3]); 121 * @param pArgs The handler arguments. 122 * @param pDebugger Pointer to the debugger interface. 123 */ 124 static RTEXITCODE handleDebugVM_Info(HandlerArg *pArgs, IMachineDebugger *pDebugger) 125 { 126 /* 127 * Parse arguments. 128 */ 129 const char *pszInfo = NULL; 130 const char *pszArgs = NULL; 131 RTGETOPTSTATE GetState; 132 RTGETOPTUNION ValueUnion; 133 int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, NULL, 0, 2, RTGETOPTINIT_FLAGS_OPTS_FIRST); 134 AssertRCReturn(rc, RTEXITCODE_FAILURE); 135 136 while ((rc = RTGetOpt(&GetState, &ValueUnion)) != 0) 137 { 138 switch (rc) 139 { 140 case VINF_GETOPT_NOT_OPTION: 141 if (!pszInfo) 142 pszInfo = ValueUnion.psz; 143 else if (!pszArgs) 144 pszArgs = ValueUnion.psz; 145 else 146 return errorTooManyParameters(&pArgs->argv[GetState.iNext - 1]); 147 break; 148 default: 149 return errorGetOpt(rc, &ValueUnion); 150 } 151 } 152 153 if (!pszInfo) 154 return errorSyntax("Must specify info item to display"); 155 156 /* 157 * Do the work. 158 */ 159 com::Bstr bstrName(pszInfo); 160 com::Bstr bstrArgs(pszArgs); 131 161 com::Bstr bstrInfo; 132 162 CHECK_ERROR2I_RET(pDebugger, Info(bstrName.raw(), bstrArgs.raw(), bstrInfo.asOutParam()), RTEXITCODE_FAILURE); … … 145 175 { 146 176 if (a->argc != 2) 147 return error Syntax(USAGE_DEBUGVM, "The inject sub-command does not take any arguments");177 return errorTooManyParameters(&a->argv[1]); 148 178 CHECK_ERROR2I_RET(pDebugger, InjectNMI(), RTEXITCODE_FAILURE); 149 179 return RTEXITCODE_SUCCESS; … … 263 293 case 'c': 264 294 if (pszCompression) 265 return errorSyntax( USAGE_DEBUGVM,"The --compression option has already been given");295 return errorSyntax("The --compression option has already been given"); 266 296 pszCompression = ValueUnion.psz; 267 297 break; 268 298 case 'f': 269 299 if (pszFilename) 270 return errorSyntax( USAGE_DEBUGVM,"The --filename option has already been given");300 return errorSyntax("The --filename option has already been given"); 271 301 pszFilename = ValueUnion.psz; 272 302 break; 273 303 default: 274 return errorGetOpt( USAGE_DEBUGVM,rc, &ValueUnion);304 return errorGetOpt(rc, &ValueUnion); 275 305 } 276 306 } 277 307 278 308 if (!pszFilename) 279 return errorSyntax( USAGE_DEBUGVM,"The --filename option is required");309 return errorSyntax("The --filename option is required"); 280 310 281 311 /* … … 303 333 { 304 334 if (a->argc != 2) 305 return error Syntax(USAGE_DEBUGVM, "The osdetect sub-command does not take any arguments");335 return errorTooManyParameters(&a->argv[1]); 306 336 307 337 com::Bstr bstrIgnore; … … 325 355 { 326 356 if (a->argc != 2) 327 return error Syntax(USAGE_DEBUGVM, "The osinfo sub-command does not take any arguments");357 return errorTooManyParameters(&a->argv[1]); 328 358 329 359 com::Bstr bstrName; … … 361 391 { 362 392 case 'n': uMaxMessages = ValueUnion.u32; break; 363 default: return errorGetOpt( USAGE_DEBUGVM,rc, &ValueUnion);393 default: return errorGetOpt(rc, &ValueUnion); 364 394 } 365 395 … … 410 440 const char *pszEqual = strchr(ValueUnion.psz, '='); 411 441 if (!pszEqual) 412 return errorSyntax( USAGE_DEBUGVM,"setregisters expects input on the form 'register=value' got '%s'", ValueUnion.psz);442 return errorSyntax("setregisters expects input on the form 'register=value' got '%s'", ValueUnion.psz); 413 443 try 414 444 { … … 428 458 429 459 default: 430 return errorGetOpt( USAGE_DEBUGVM,rc, &ValueUnion);460 return errorGetOpt(rc, &ValueUnion); 431 461 } 432 462 } 433 463 434 464 if (!aBstrNames.size()) 435 return errorSyntax( USAGE_DEBUGVM,"The setregisters sub-command takes at least one register name");465 return errorSyntax("The setregisters sub-command takes at least one register name"); 436 466 437 467 /* … … 590 620 rcExit = handleDebugVM_Show_LogRelSettings(pDebugger, fFlags); 591 621 else 592 rcExit = errorSyntax( USAGE_DEBUGVM,"The show sub-command has no idea what '%s' might be", ValueUnion.psz);622 rcExit = errorSyntax("The show sub-command has no idea what '%s' might be", ValueUnion.psz); 593 623 if (rcExit != RTEXITCODE_SUCCESS) 594 624 return rcExit; … … 597 627 598 628 default: 599 return errorGetOpt( USAGE_DEBUGVM,rc, &ValueUnion);629 return errorGetOpt(rc, &ValueUnion); 600 630 } 601 631 } … … 640 670 case 'p': 641 671 if (pszPattern) 642 return errorSyntax( USAGE_DEBUGVM,"Multiple --pattern options are not permitted");672 return errorSyntax("Multiple --pattern options are not permitted"); 643 673 pszPattern = ValueUnion.psz; 644 674 break; … … 649 679 650 680 default: 651 return errorGetOpt( USAGE_DEBUGVM,rc, &ValueUnion);681 return errorGetOpt(rc, &ValueUnion); 652 682 } 653 683 } 654 684 655 685 if (fReset && fWithDescriptions) 656 return errorSyntax( USAGE_DEBUGVM,"The --reset and --descriptions options does not mix");686 return errorSyntax("The --reset and --descriptions options does not mix"); 657 687 658 688 /* … … 685 715 */ 686 716 if (pArgs->argc < 2) 687 return error Syntax(USAGE_DEBUGVM, "Too few parameters");717 return errorNoSubcommand(); 688 718 ComPtr<IMachine> ptrMachine; 689 719 CHECK_ERROR2I_RET(pArgs->virtualBox, FindMachine(com::Bstr(pArgs->argv[0]).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE); … … 708 738 */ 709 739 const char *pszSubCmd = pArgs->argv[1]; 710 if (!strcmp(pszSubCmd, "dumpguestcore")) 740 if (!strcmp(pszSubCmd, "dumpvmcore")) 741 { 742 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_DUMPVMCORE); 711 743 rcExit = handleDebugVM_DumpVMCore(pArgs, ptrDebugger); 744 } 712 745 else if (!strcmp(pszSubCmd, "getregisters")) 746 { 747 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_GETREGISTERS); 713 748 rcExit = handleDebugVM_GetRegisters(pArgs, ptrDebugger); 749 } 714 750 else if (!strcmp(pszSubCmd, "info")) 751 { 752 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_INFO); 715 753 rcExit = handleDebugVM_Info(pArgs, ptrDebugger); 754 } 716 755 else if (!strcmp(pszSubCmd, "injectnmi")) 756 { 757 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_INJECTNMI); 717 758 rcExit = handleDebugVM_InjectNMI(pArgs, ptrDebugger); 759 } 718 760 else if (!strcmp(pszSubCmd, "log")) 761 { 762 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_LOG); 719 763 rcExit = handleDebugVM_LogXXXX(pArgs, ptrDebugger, pszSubCmd); 764 } 720 765 else if (!strcmp(pszSubCmd, "logdest")) 766 { 767 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_LOGDEST); 721 768 rcExit = handleDebugVM_LogXXXX(pArgs, ptrDebugger, pszSubCmd); 769 } 722 770 else if (!strcmp(pszSubCmd, "logflags")) 771 { 772 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_LOGFLAGS); 723 773 rcExit = handleDebugVM_LogXXXX(pArgs, ptrDebugger, pszSubCmd); 774 } 724 775 else if (!strcmp(pszSubCmd, "osdetect")) 776 { 777 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_OSDETECT); 725 778 rcExit = handleDebugVM_OSDetect(pArgs, ptrDebugger); 779 } 726 780 else if (!strcmp(pszSubCmd, "osinfo")) 781 { 782 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_OSINFO); 727 783 rcExit = handleDebugVM_OSInfo(pArgs, ptrDebugger); 784 } 728 785 else if (!strcmp(pszSubCmd, "osdmesg")) 786 { 787 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_OSDMESG); 729 788 rcExit = handleDebugVM_OSDmesg(pArgs, ptrDebugger); 789 } 730 790 else if (!strcmp(pszSubCmd, "setregisters")) 791 { 792 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_SETREGISTERS); 731 793 rcExit = handleDebugVM_SetRegisters(pArgs, ptrDebugger); 794 } 732 795 else if (!strcmp(pszSubCmd, "show")) 796 { 797 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_SHOW); 733 798 rcExit = handleDebugVM_Show(pArgs, ptrDebugger); 799 } 734 800 else if (!strcmp(pszSubCmd, "statistics")) 801 { 802 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_STATISTICS); 735 803 rcExit = handleDebugVM_Statistics(pArgs, ptrDebugger); 804 } 736 805 else 737 error Syntax(USAGE_DEBUGVM, "Invalid parameter '%s'", pArgs->argv[1]);806 errorUnknownSubcommand(pszSubCmd); 738 807 } 739 808 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r56366 r56466 399 399 return RTEXITCODE_SUCCESS; 400 400 } 401 else if (!strcmp(papszArgs[i], "--")) 402 break; 401 403 402 404 return errorSyntax("Too many parameters"); … … 1326 1328 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n" 1327 1329 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n" 1328 # if !defined(RT_OS_SOLARIS) 1330 # if !defined(RT_OS_SOLARIS) || defined(VBOX_ONLY_DOCS) 1329 1331 " create |\n" 1330 1332 " remove <name>\n"
Note:
See TracChangeset
for help on using the changeset viewer.