Changeset 35242 in vbox
- Timestamp:
- Dec 20, 2010 1:33:23 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
-
Frontends/VBoxManage/VBoxManageDebugVM.cpp (modified) (4 diffs)
-
Main/MachineDebuggerImpl.cpp (modified) (2 diffs)
-
Main/idl/VirtualBox.xidl (modified) (2 diffs)
-
Main/include/MachineDebuggerImpl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
r34971 r35242 70 70 * Parse arguments. 71 71 */ 72 const char *pszFilename = NULL; 72 const char *pszFilename = NULL; 73 const char *pszCompression = NULL; 73 74 74 75 RTGETOPTSTATE GetState; … … 76 77 static const RTGETOPTDEF s_aOptions[] = 77 78 { 78 { "--filename", 'f', RTGETOPT_REQ_STRING } 79 { "--filename", 'f', RTGETOPT_REQ_STRING }, 80 { "--compression", 'c', RTGETOPT_REQ_STRING } 79 81 }; 80 82 int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, 0 /*fFlags*/); … … 85 87 switch (rc) 86 88 { 89 case 'c': 90 if (pszCompression) 91 return errorSyntax(USAGE_DEBUGVM, "The --compression option has already been given"); 92 pszCompression = ValueUnion.psz; 93 break; 87 94 case 'f': 88 95 if (pszFilename) … … 107 114 108 115 com::Bstr bstrFilename(szAbsFilename); 109 CHECK_ERROR2_RET(pDebugger, DumpGuestCore(bstrFilename.raw()), RTEXITCODE_FAILURE); 116 com::Bstr bstrCompression(pszCompression); 117 CHECK_ERROR2_RET(pDebugger, DumpGuestCore(bstrFilename.raw(), bstrCompression.raw()), RTEXITCODE_FAILURE); 110 118 return RTEXITCODE_SUCCESS; 111 119 } -
trunk/src/VBox/Main/MachineDebuggerImpl.cpp
r34913 r35242 651 651 ///////////////////////////////////////////////////////////////////////////// 652 652 653 /** 654 * Resets VM statistics. 655 * 656 * @returns COM status code. 657 * @param aPattern The selection pattern. A bit similar to filename globbing. 658 */ 659 STDMETHODIMP MachineDebugger::ResetStats(IN_BSTR aPattern) 660 { 661 Console::SafeVMPtrQuiet pVM (mParent); 662 663 if (!pVM.isOk()) 664 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 665 666 STAMR3Reset(pVM, Utf8Str(aPattern).c_str()); 667 668 return S_OK; 669 } 670 671 /** 672 * Dumps VM statistics to the log. 673 * 674 * @returns COM status code. 675 * @param aPattern The selection pattern. A bit similar to filename globbing. 676 */ 677 STDMETHODIMP MachineDebugger::DumpStats (IN_BSTR aPattern) 678 { 679 Console::SafeVMPtrQuiet pVM (mParent); 680 681 if (!pVM.isOk()) 682 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 683 684 STAMR3Dump(pVM, Utf8Str(aPattern).c_str()); 685 686 return S_OK; 687 } 688 689 /** 690 * Get the VM statistics in an XML format. 691 * 692 * @returns COM status code. 693 * @param aPattern The selection pattern. A bit similar to filename globbing. 694 * @param aWithDescriptions Whether to include the descriptions. 695 * @param aStats The XML document containing the statistics. 696 */ 697 STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats) 698 { 699 Console::SafeVMPtrQuiet pVM (mParent); 700 701 if (!pVM.isOk()) 702 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 703 704 char *pszSnapshot; 705 int vrc = STAMR3Snapshot(pVM, Utf8Str(aPattern).c_str(), &pszSnapshot, NULL, 706 !!aWithDescriptions); 707 if (RT_FAILURE(vrc)) 708 return vrc == VERR_NO_MEMORY ? E_OUTOFMEMORY : E_FAIL; 709 710 /** @todo this is horribly inefficient! And it's kinda difficult to tell whether it failed... 711 * Must use UTF-8 or ASCII here and completely avoid these two extra copy operations. 712 * Until that's done, this method is kind of useless for debugger statistics GUI because 713 * of the amount statistics in a debug build. */ 714 Bstr (pszSnapshot).cloneTo(aStats); 715 716 return S_OK; 717 } 718 719 /** 720 * Injects an NMI. 721 * 722 * @returns COM status code 723 */ 653 STDMETHODIMP MachineDebugger::DumpGuestCore(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression) 654 { 655 CheckComArgStrNotEmptyOrNull(a_bstrFilename); 656 Utf8Str strFilename(a_bstrFilename); 657 if (a_bstrCompression && *a_bstrCompression) 658 return setError(E_INVALIDARG, tr("The compression parameter must be empty")); 659 660 AutoCaller autoCaller(this); 661 HRESULT hrc = autoCaller.rc(); 662 if (SUCCEEDED(hrc)) 663 { 664 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 665 Console::SafeVMPtr ptrVM(mParent); 666 hrc = ptrVM.rc(); 667 if (SUCCEEDED(hrc)) 668 { 669 int vrc = DBGFR3CoreWrite(ptrVM, strFilename.c_str(), false /*fReplaceFile*/); 670 if (RT_SUCCESS(vrc)) 671 hrc = S_OK; 672 else 673 hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc); 674 } 675 } 676 677 return hrc; 678 } 679 680 STDMETHODIMP MachineDebugger::DumpHostProcessCore(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression) 681 { 682 ReturnComNotImplemented(); 683 } 684 685 STDMETHODIMP MachineDebugger::Info(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR *a_pbstrInfo) 686 { 687 ReturnComNotImplemented(); 688 } 689 724 690 STDMETHODIMP MachineDebugger::InjectNMI() 725 691 { … … 745 711 } 746 712 747 /** 748 * Triggers a guest core dump. 749 * 750 * @returns COM status code 751 * @param 752 */ 753 STDMETHODIMP MachineDebugger::DumpGuestCore(IN_BSTR a_bstrFilename) 754 { 755 CheckComArgStrNotEmptyOrNull(a_bstrFilename); 756 Utf8Str strFilename(a_bstrFilename); 757 758 AutoCaller autoCaller(this); 759 HRESULT hrc = autoCaller.rc(); 760 if (SUCCEEDED(hrc)) 761 { 762 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 763 Console::SafeVMPtr ptrVM(mParent); 764 hrc = ptrVM.rc(); 765 if (SUCCEEDED(hrc)) 766 { 767 int vrc = DBGFR3CoreWrite(ptrVM, strFilename.c_str(), false /*fReplaceFile*/); 768 if (RT_SUCCESS(vrc)) 769 hrc = S_OK; 770 else 771 hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc); 772 } 773 } 774 775 return hrc; 713 STDMETHODIMP MachineDebugger::ReadPhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData)) 714 { 715 ReturnComNotImplemented(); 716 } 717 718 STDMETHODIMP MachineDebugger::WritePhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData)) 719 { 720 ReturnComNotImplemented(); 721 } 722 723 STDMETHODIMP MachineDebugger::ReadVirtualMemory(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData)) 724 { 725 ReturnComNotImplemented(); 726 } 727 728 STDMETHODIMP MachineDebugger::WriteVirtualMemory(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData)) 729 { 730 ReturnComNotImplemented(); 731 } 732 733 STDMETHODIMP MachineDebugger::GetRegister(ULONG a_idCpu, IN_BSTR a_bstrName, BSTR *a_pbstrValue) 734 { 735 ReturnComNotImplemented(); 736 } 737 738 STDMETHODIMP MachineDebugger::GetRegisters(ULONG a_idCpu, ComSafeArrayOut(BSTR, a_bstrNames), ComSafeArrayOut(BSTR, a_bstrValues)) 739 { 740 ReturnComNotImplemented(); 741 } 742 743 STDMETHODIMP MachineDebugger::SetRegister(ULONG a_idCpu, IN_BSTR a_bstrName, IN_BSTR a_bstrValue) 744 { 745 ReturnComNotImplemented(); 746 } 747 748 STDMETHODIMP MachineDebugger::SetRegisters(ULONG a_idCpu, ComSafeArrayIn(IN_BSTR, a_bstrNames), ComSafeArrayIn(IN_BSTR, a_bstrValues)) 749 { 750 ReturnComNotImplemented(); 751 } 752 753 /** 754 * Resets VM statistics. 755 * 756 * @returns COM status code. 757 * @param aPattern The selection pattern. A bit similar to filename globbing. 758 */ 759 STDMETHODIMP MachineDebugger::ResetStats(IN_BSTR aPattern) 760 { 761 Console::SafeVMPtrQuiet pVM (mParent); 762 763 if (!pVM.isOk()) 764 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 765 766 STAMR3Reset(pVM, Utf8Str(aPattern).c_str()); 767 768 return S_OK; 769 } 770 771 /** 772 * Dumps VM statistics to the log. 773 * 774 * @returns COM status code. 775 * @param aPattern The selection pattern. A bit similar to filename globbing. 776 */ 777 STDMETHODIMP MachineDebugger::DumpStats (IN_BSTR aPattern) 778 { 779 Console::SafeVMPtrQuiet pVM (mParent); 780 781 if (!pVM.isOk()) 782 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 783 784 STAMR3Dump(pVM, Utf8Str(aPattern).c_str()); 785 786 return S_OK; 787 } 788 789 /** 790 * Get the VM statistics in an XML format. 791 * 792 * @returns COM status code. 793 * @param aPattern The selection pattern. A bit similar to filename globbing. 794 * @param aWithDescriptions Whether to include the descriptions. 795 * @param aStats The XML document containing the statistics. 796 */ 797 STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats) 798 { 799 Console::SafeVMPtrQuiet pVM (mParent); 800 801 if (!pVM.isOk()) 802 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 803 804 char *pszSnapshot; 805 int vrc = STAMR3Snapshot(pVM, Utf8Str(aPattern).c_str(), &pszSnapshot, NULL, 806 !!aWithDescriptions); 807 if (RT_FAILURE(vrc)) 808 return vrc == VERR_NO_MEMORY ? E_OUTOFMEMORY : E_FAIL; 809 810 /** @todo this is horribly inefficient! And it's kinda difficult to tell whether it failed... 811 * Must use UTF-8 or ASCII here and completely avoid these two extra copy operations. 812 * Until that's done, this method is kind of useless for debugger statistics GUI because 813 * of the amount statistics in a debug build. */ 814 Bstr(pszSnapshot).detachTo(aStats); 815 816 return S_OK; 776 817 } 777 818 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r35177 r35242 11889 11889 <interface 11890 11890 name="IMachineDebugger" extends="$unknown" 11891 uuid=" 373a5f51-67c1-4a31-be43-1e29ebe8ef85"11891 uuid="b1fd749c-e471-4ae3-863f-54b4f787cdef" 11892 11892 wsmap="suppress" 11893 11893 > 11894 <method name="dumpGuestCore"> 11895 <desc> 11896 Takes a core dump of the guest. 11897 11898 See include/VBox/dbgfcorefmt.h for details on the file format. 11899 </desc> 11900 <param name="filename" type="wstring" dir="in"> 11901 <desc> 11902 The name of the output file. The file must not exist. 11903 </desc> 11904 </param> 11905 <param name="compression" type="wstring" dir="in"> 11906 <desc> 11907 Reserved for future compression method indicator. 11908 </desc> 11909 </param> 11910 </method> 11911 11912 <method name="dumpHostProcessCore"> 11913 <desc> 11914 Takes a core dump of the VM process on the host. 11915 11916 This feature is not implemented in the 4.0.0 release but it may show up 11917 in a dot release. 11918 </desc> 11919 <param name="filename" type="wstring" dir="in"> 11920 <desc> 11921 The name of the output file. The file must not exist. 11922 </desc> 11923 </param> 11924 <param name="compression" type="wstring" dir="in"> 11925 <desc> 11926 Reserved for future compression method indicator. 11927 </desc> 11928 </param> 11929 </method> 11930 11931 <method name="info"> 11932 <desc> 11933 Interfaces with the info dumpers (DBGFInfo). 11934 11935 This feature is not implemented in the 4.0.0 release but it may show up 11936 in a dot release. 11937 </desc> 11938 <param name="name" type="wstring" dir="in"> 11939 <desc> 11940 The name of the info item. 11941 </desc> 11942 </param> 11943 <param name="args" type="wstring" dir="in"> 11944 <desc> 11945 Arguments to the info dumper. 11946 </desc> 11947 </param> 11948 <param name="info" type="wstring" dir="return"> 11949 <desc> 11950 The into string. 11951 </desc> 11952 </param> 11953 </method> 11954 11955 <method name="injectNMI"> 11956 <desc> 11957 Inject an NMI into a running VT-x/AMD-V VM. 11958 </desc> 11959 </method> 11960 11961 <method name="readPhysicalMemory"> 11962 <desc> 11963 Reads guest physical memory, no side effects (MMIO++). 11964 11965 This feature is not implemented in the 4.0.0 release but may show up 11966 in a dot release. 11967 </desc> 11968 <param name="address" type="long long" dir="in"> 11969 <desc>The guest physical address.</desc> 11970 </param> 11971 <param name="size" type="unsigned long" dir="in"> 11972 <desc>The number of bytes to read.</desc> 11973 </param> 11974 <param name="bytes" type="octet" safearray="yes" dir="return"> 11975 <desc>The bytes read.</desc> 11976 </param> 11977 </method> 11978 11979 <method name="writePhysicalMemory"> 11980 <desc> 11981 Writes guest physical memory, access handles (MMIO++) are ignored. 11982 11983 This feature is not implemented in the 4.0.0 release but may show up 11984 in a dot release. 11985 </desc> 11986 <param name="address" type="long long" dir="in"> 11987 <desc>The guest physical address.</desc> 11988 </param> 11989 <param name="size" type="unsigned long" dir="in"> 11990 <desc>The number of bytes to read.</desc> 11991 </param> 11992 <param name="bytes" type="octet" safearray="yes" dir="in"> 11993 <desc>The bytes to write.</desc> 11994 </param> 11995 </method> 11996 11997 <method name="readVirtualMemory"> 11998 <desc> 11999 Reads guest virtual memory, no side effects (MMIO++). 12000 12001 This feature is not implemented in the 4.0.0 release but may show up 12002 in a dot release. 12003 </desc> 12004 <param name="cpuId" type="unsigned long" dir="in"> 12005 <desc>The identifier of the Virtual CPU.</desc> 12006 </param> 12007 <param name="address" type="long long" dir="in"> 12008 <desc>The guest virtual address.</desc> 12009 </param> 12010 <param name="size" type="unsigned long" dir="in"> 12011 <desc>The number of bytes to read.</desc> 12012 </param> 12013 <param name="bytes" type="octet" safearray="yes" dir="return"> 12014 <desc>The bytes read.</desc> 12015 </param> 12016 </method> 12017 12018 <method name="writeVirtualMemory"> 12019 <desc> 12020 Writes guest virtual memory, access handles (MMIO++) are ignored. 12021 12022 This feature is not implemented in the 4.0.0 release but may show up 12023 in a dot release. 12024 </desc> 12025 <param name="cpuId" type="unsigned long" dir="in"> 12026 <desc>The identifier of the Virtual CPU.</desc> 12027 </param> 12028 <param name="address" type="long long" dir="in"> 12029 <desc>The guest virtual address.</desc> 12030 </param> 12031 <param name="size" type="unsigned long" dir="in"> 12032 <desc>The number of bytes to read.</desc> 12033 </param> 12034 <param name="bytes" type="octet" safearray="yes" dir="in"> 12035 <desc>The bytes to write.</desc> 12036 </param> 12037 </method> 12038 12039 <method name="getRegister"> 12040 <desc> 12041 Gets one register. 12042 12043 This feature is not implemented in the 4.0.0 release but may show up 12044 in a dot release. 12045 </desc> 12046 <param name="cpuId" type="unsigned long" dir="in"> 12047 <desc>The identifier of the Virtual CPU.</desc> 12048 </param> 12049 <param name="name" type="wstring" dir="in"> 12050 <desc>The register name, case is ignored.</desc> 12051 </param> 12052 <param name="value" type="wstring" dir="return"> 12053 <desc> 12054 The register value. This is usually a hex value (always 0x prefixed) 12055 but other format may be used for floating point registers (TBD). 12056 </desc> 12057 </param> 12058 </method> 12059 12060 <method name="getRegisters"> 12061 <desc> 12062 Gets all the registers for the given CPU. 12063 12064 This feature is not implemented in the 4.0.0 release but may show up 12065 in a dot release. 12066 </desc> 12067 <param name="cpuId" type="unsigned long" dir="in"> 12068 <desc>The identifier of the Virtual CPU.</desc> 12069 </param> 12070 <param name="names" type="wstring" dir="out" safearray="yes"> 12071 <desc>Array containing the lowercase register names.</desc> 12072 </param> 12073 <param name="values" type="wstring" dir="out" safearray="yes"> 12074 <desc> 12075 Array paralell to the names holding the register values as if the 12076 register was returned by <link name="IMachineDebugger::getRegister"/>. 12077 </desc> 12078 </param> 12079 </method> 12080 12081 <method name="setRegister"> 12082 <desc> 12083 Gets one register. 12084 12085 This feature is not implemented in the 4.0.0 release but may show up 12086 in a dot release. 12087 </desc> 12088 <param name="cpuId" type="unsigned long" dir="in"> 12089 <desc>The identifier of the Virtual CPU.</desc> 12090 </param> 12091 <param name="name" type="wstring" dir="in"> 12092 <desc>The register name, case is ignored.</desc> 12093 </param> 12094 <param name="value" type="wstring" dir="in"> 12095 <desc> 12096 The new register value. Hexadecimal, decimal and octal formattings 12097 are supported in addition to any special formattings returned by 12098 the getters. 12099 </desc> 12100 </param> 12101 </method> 12102 12103 <method name="setRegisters"> 12104 <desc> 12105 Sets zero or more registers atomically. 12106 12107 This feature is not implemented in the 4.0.0 release but may show up 12108 in a dot release. 12109 </desc> 12110 <param name="cpuId" type="unsigned long" dir="in"> 12111 <desc>The identifier of the Virtual CPU.</desc> 12112 </param> 12113 <param name="names" type="wstring" dir="in" safearray="yes"> 12114 <desc>Array containing the register names, case ignored.</desc> 12115 </param> 12116 <param name="values" type="wstring" dir="in" safearray="yes"> 12117 <desc> 12118 Array paralell to the names holding the register values. See 12119 <link name="IMachineDebugger::setRegister"/> for formatting 12120 guidelines. 12121 </desc> 12122 </param> 12123 </method> 12124 11894 12125 <method name="resetStats"> 11895 12126 <desc> … … 11922 12153 <param name="stats" type="wstring" dir="out"> 11923 12154 <desc>The XML document containing the statistics.</desc> 11924 </param>11925 </method>11926 11927 <method name="injectNMI">11928 <desc>11929 Inject an NMI into a running VT-x/AMD-V VM.11930 </desc>11931 </method>11932 11933 <method name="dumpGuestCore">11934 <desc>11935 Takes a core dump of the guest.11936 11937 See include/VBox/dbgfcorefmt.h for details on the file format.11938 </desc>11939 <param name="filename" type="wstring" dir="in">11940 <desc>11941 The name of the output file. The file must not exist.11942 </desc>11943 12155 </param> 11944 12156 </method> -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r34902 r35242 72 72 STDMETHOD(COMSETTER(VirtualTimeRate)) (ULONG aPct); 73 73 STDMETHOD(COMGETTER(VM)) (LONG64 *aVm); 74 STDMETHOD(InjectNMI)();75 STDMETHOD(DumpGuestCore)(IN_BSTR a_bstrFilename);76 74 77 75 // IMachineDebugger methods 78 STDMETHOD(ResetStats (IN_BSTR aPattern)); 79 STDMETHOD(DumpStats (IN_BSTR aPattern)); 80 STDMETHOD(GetStats (IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats)); 76 STDMETHOD(DumpGuestCore)(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression); 77 STDMETHOD(DumpHostProcessCore)(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression); 78 STDMETHOD(Info)(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR *a_bstrInfo); 79 STDMETHOD(InjectNMI)(); 80 STDMETHOD(ReadPhysicalMemory)(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData)); 81 STDMETHOD(WritePhysicalMemory)(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData)); 82 STDMETHOD(ReadVirtualMemory)(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData)); 83 STDMETHOD(WriteVirtualMemory)(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData)); 84 STDMETHOD(GetRegister)(ULONG a_idCpu, IN_BSTR a_bstrName, BSTR *a_pbstrValue); 85 STDMETHOD(GetRegisters)(ULONG a_idCpu, ComSafeArrayOut(BSTR, a_bstrNames), ComSafeArrayOut(BSTR, a_bstrValues)); 86 STDMETHOD(SetRegister)(ULONG a_idCpu, IN_BSTR a_bstrName, IN_BSTR a_bstrValue); 87 STDMETHOD(SetRegisters)(ULONG a_idCpu, ComSafeArrayIn(IN_BSTR, a_bstrNames), ComSafeArrayIn(IN_BSTR, a_bstrValues)); 88 STDMETHOD(ResetStats)(IN_BSTR aPattern); 89 STDMETHOD(DumpStats)(IN_BSTR aPattern); 90 STDMETHOD(GetStats)(IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats); 81 91 82 92
Note:
See TracChangeset
for help on using the changeset viewer.

