Changeset 61937 in vbox
- Timestamp:
- Jun 29, 2016 4:36:07 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
doc/manual/en_US/man_VBoxManage-debugvm.xml (modified) (3 diffs)
-
src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp (modified) (5 diffs)
-
src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/man_VBoxManage-debugvm.xml
r61673 r61937 39 39 <arg>--filename=<replaceable>name</replaceable></arg> 40 40 </cmdsynopsis> 41 <cmdsynopsis id="synopsis-vboxmanage-debugvm-dumpgueststack">42 <command>VBoxManage debugvm</command>43 <arg choice="req"><replaceable>uuid|vmname</replaceable></arg>44 <arg choice="plain">dumpgueststack</arg>45 <arg>--cpu=<replaceable>id</replaceable></arg>46 </cmdsynopsis>47 41 <cmdsynopsis id="synopsis-vboxmanage-debugvm-info"> 48 42 <command>VBoxManage debugvm</command> … … 114 108 <group><arg>--human-readable</arg><arg>--sh-export</arg><arg>--sh-eval</arg><arg>--cmd-set</arg></group> 115 109 <arg rep="repeat"><replaceable>settings-item</replaceable></arg> 110 </cmdsynopsis> 111 <cmdsynopsis id="synopsis-vboxmanage-debugvm-stack"> 112 <command>VBoxManage debugvm</command> 113 <arg choice="req"><replaceable>uuid|vmname</replaceable></arg> 114 <arg choice="plain">stack</arg> 115 <arg>--cpu=<replaceable>id</replaceable></arg> 116 116 </cmdsynopsis> 117 117 <cmdsynopsis id="synopsis-vboxmanage-debugvm-statistics"> … … 569 569 </refsect2> 570 570 571 <refsect2 id="vboxmanage-debugvm-stack"> 572 <title>debugvm stack</title> 573 <remark role="help-copy-synopsis"/> 574 <para> 575 Unwinds the guest CPU stacks to the best of our ability. For Windows 576 guest it is recommended to first run the <command>osdetect</command> command. 577 </para> 578 <variablelist> 579 <varlistentry> 580 <term><option>--cpu <replaceable>id</replaceable></option></term> 581 <listitem><para>Selects a single guest CPU to display the stack for. The default is all CPUs.</para> </listitem> 582 </varlistentry> 583 </variablelist> 584 585 </refsect2> 586 571 587 <refsect2 id="vboxmanage-debugvm-statistics"> 572 588 <title>debugvm statistics</title> -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
r61673 r61937 28 28 #include <VBox/com/VirtualBox.h> 29 29 30 #include <VBox/types.h> 30 31 #include <iprt/ctype.h> 31 32 #include <VBox/err.h> … … 640 641 641 642 /** 643 * Handles the stack sub-command. 644 * 645 * @returns Suitable exit code. 646 * @param pArgs The handler arguments. 647 * @param pDebugger Pointer to the debugger interface. 648 */ 649 static RTEXITCODE handleDebugVM_Stack(HandlerArg *pArgs, IMachineDebugger *pDebugger) 650 { 651 /* 652 * Parse arguments. 653 */ 654 VMCPUID idCpu = VMCPUID_ALL; 655 656 RTGETOPTSTATE GetState; 657 RTGETOPTUNION ValueUnion; 658 static const RTGETOPTDEF s_aOptions[] = 659 { 660 { "--cpu", 'c', RTGETOPT_REQ_UINT32 }, 661 }; 662 int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, RTGETOPTINIT_FLAGS_OPTS_FIRST); 663 AssertRCReturn(rc, RTEXITCODE_FAILURE); 664 665 while ((rc = RTGetOpt(&GetState, &ValueUnion)) != 0) 666 { 667 switch (rc) 668 { 669 case 'c': 670 idCpu = ValueUnion.u32; 671 break; 672 673 default: 674 return errorGetOpt(rc, &ValueUnion); 675 } 676 } 677 678 /* 679 * Dump stack. 680 */ 681 com::Bstr bstrGuestStack; 682 if (idCpu != VMCPUID_ALL) 683 { 684 /* Single CPU */ 685 CHECK_ERROR2I_RET(pDebugger, DumpGuestStack(idCpu, bstrGuestStack.asOutParam()), RTEXITCODE_FAILURE); 686 RTPrintf("%ls\n", bstrGuestStack.raw()); 687 } 688 else 689 { 690 /* All CPUs. */ 691 ComPtr<IMachine> ptrMachine; 692 CHECK_ERROR2I_RET(pArgs->session, COMGETTER(Machine)(ptrMachine.asOutParam()), RTEXITCODE_FAILURE); 693 ULONG cCpus; 694 CHECK_ERROR2I_RET(ptrMachine, COMGETTER(CPUCount)(&cCpus), RTEXITCODE_FAILURE); 695 696 for (idCpu = 0; idCpu < (VMCPUID)cCpus; idCpu++) 697 { 698 CHECK_ERROR2I_RET(pDebugger, DumpGuestStack(idCpu, bstrGuestStack.asOutParam()), RTEXITCODE_FAILURE); 699 if (cCpus > 1) 700 { 701 if (idCpu > 0) 702 RTPrintf("\n"); 703 RTPrintf("====================== CPU #%u ======================\n", idCpu); 704 } 705 RTPrintf("%ls\n", bstrGuestStack.raw()); 706 } 707 } 708 709 710 return RTEXITCODE_SUCCESS; 711 } 712 713 /** 642 714 * Handles the statistics sub-command. 643 715 * … … 713 785 } 714 786 715 /**716 * Handles the dumpgueststack sub-command.717 *718 * @returns Suitable exit code.719 * @param pArgs The handler arguments.720 * @param pDebugger Pointer to the debugger interface.721 */722 static RTEXITCODE handleDebugVM_DumpGuestStack(HandlerArg *pArgs, IMachineDebugger *pDebugger)723 {724 ULONG idCpu = 0;725 726 RTGETOPTSTATE GetState;727 RTGETOPTUNION ValueUnion;728 static const RTGETOPTDEF s_aOptions[] =729 {730 { "--cpu", 'c', RTGETOPT_REQ_UINT32 },731 };732 int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, RTGETOPTINIT_FLAGS_OPTS_FIRST);733 AssertRCReturn(rc, RTEXITCODE_FAILURE);734 735 while ((rc = RTGetOpt(&GetState, &ValueUnion)) != 0)736 {737 switch (rc)738 {739 case 'c':740 idCpu = ValueUnion.u32;741 break;742 743 default:744 return errorGetOpt(rc, &ValueUnion);745 }746 }747 748 com::Bstr bstrGuestStack;749 CHECK_ERROR2I_RET(pDebugger, DumpGuestStack(idCpu, bstrGuestStack.asOutParam()),750 RTEXITCODE_FAILURE);751 752 RTPrintf("%ls\n", bstrGuestStack.raw());753 754 return RTEXITCODE_SUCCESS;755 }756 757 787 RTEXITCODE handleDebugVM(HandlerArg *pArgs) 758 788 { … … 771 801 * Get the associated console and machine debugger. 772 802 */ 773 HRESULT rc;803 HRESULT hrc; 774 804 ComPtr<IConsole> ptrConsole; 775 CHECK_ERROR (pArgs->session, COMGETTER(Console)(ptrConsole.asOutParam()));776 if (SUCCEEDED( rc))805 CHECK_ERROR2(hrc, pArgs->session, COMGETTER(Console)(ptrConsole.asOutParam())); 806 if (SUCCEEDED(hrc)) 777 807 { 778 808 if (ptrConsole.isNotNull()) 779 809 { 780 810 ComPtr<IMachineDebugger> ptrDebugger; 781 CHECK_ERROR (ptrConsole, COMGETTER(Debugger)(ptrDebugger.asOutParam()));782 if (SUCCEEDED( rc))811 CHECK_ERROR2(hrc, ptrConsole, COMGETTER(Debugger)(ptrDebugger.asOutParam())); 812 if (SUCCEEDED(hrc)) 783 813 { 784 814 /* … … 846 876 rcExit = handleDebugVM_Show(pArgs, ptrDebugger); 847 877 } 878 else if (!strcmp(pszSubCmd, "stack")) 879 { 880 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_STACK); 881 rcExit = handleDebugVM_Stack(pArgs, ptrDebugger); 882 } 848 883 else if (!strcmp(pszSubCmd, "statistics")) 849 884 { 850 885 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_STATISTICS); 851 886 rcExit = handleDebugVM_Statistics(pArgs, ptrDebugger); 852 }853 else if (!strcmp(pszSubCmd, "dumpgueststack"))854 {855 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_DUMPGUESTSTACK);856 rcExit = handleDebugVM_DumpGuestStack(pArgs, ptrDebugger);857 887 } 858 888 else -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r61673 r61937 1274 1274 #endif /* VBOX_WITH_GUEST_CONTROL defined */ 1275 1275 1276 if (fCategory & USAGE_DEBUGVM)1277 {1278 RTStrmPrintf(pStrm,1279 "%s debugvm %s <uuid|vmname>\n"1280 " dumpvmcore --filename <name> |\n"1281 " dumpgueststack [--cpu <id>]\n"1282 " info <item> [args] |\n"1283 " injectnmi |\n"1284 " log [--release|--debug] <settings> ...|\n"1285 " logdest [--release|--debug] <settings> ...|\n"1286 " logflags [--release|--debug] <settings> ...|\n"1287 " osdetect |\n"1288 " osinfo |\n"1289 " osdmesg [--lines|-n <N>] |\n"1290 " getregisters [--cpu <id>] <reg>|all ... |\n"1291 " setregisters [--cpu <id>] <reg>=<value> ... |\n"1292 " show [--human-readable|--sh-export|--sh-eval|\n"1293 " --cmd-set] \n"1294 " <logdbg-settings|logrel-settings>\n"1295 " [[opt] what ...] |\n"1296 " statistics [--reset] [--pattern <pattern>]\n"1297 " [--descriptions]\n"1298 "\n", SEP);1299 }1300 1276 if (fCategory & USAGE_METRICS) 1301 1277 RTStrmPrintf(pStrm, … … 1406 1382 { 1407 1383 PCREFENTRY pHelp = g_apHelpEntries[i]; 1408 RTStrmPrintf(pStrm, " %c%s:\n", RT_C_TO_UPPER(pHelp->pszBrief[0]), pHelp->pszBrief + 1); 1409 cPendingBlankLines = printStringTable(pStrm, &pHelp->Synopsis, REFENTRYSTR_SCOPE_GLOBAL, cPendingBlankLines); 1410 if (!cPendingBlankLines) 1411 cPendingBlankLines = 1; 1384 while (cPendingBlankLines-- > 0) 1385 RTStrmPutCh(pStrm, '\n'); 1386 RTStrmPrintf(pStrm, " %c%s:\n", RT_C_TO_UPPER(pHelp->pszBrief[0]), pHelp->pszBrief + 1); 1387 cPendingBlankLines = printStringTable(pStrm, &pHelp->Synopsis, REFENTRYSTR_SCOPE_GLOBAL, 0); 1388 cPendingBlankLines = RT_MAX(cPendingBlankLines, 1); 1412 1389 } 1413 1390 } 1414 1415 1391 #endif 1416 1392 }
Note:
See TracChangeset
for help on using the changeset viewer.

