1 | /* $Id: MachineDebuggerImpl.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_MachineDebuggerImpl_h
|
---|
29 | #define MAIN_INCLUDED_MachineDebuggerImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "MachineDebuggerWrap.h"
|
---|
35 | #include <iprt/log.h>
|
---|
36 | #include <VBox/vmm/em.h>
|
---|
37 |
|
---|
38 | class Console;
|
---|
39 | class Progress;
|
---|
40 |
|
---|
41 | class ATL_NO_VTABLE MachineDebugger :
|
---|
42 | public MachineDebuggerWrap
|
---|
43 | {
|
---|
44 |
|
---|
45 | public:
|
---|
46 |
|
---|
47 | DECLARE_COMMON_CLASS_METHODS (MachineDebugger)
|
---|
48 |
|
---|
49 | HRESULT FinalConstruct();
|
---|
50 | void FinalRelease();
|
---|
51 |
|
---|
52 | // public initializer/uninitializer for internal purposes only
|
---|
53 | HRESULT init (Console *aParent);
|
---|
54 | void uninit();
|
---|
55 |
|
---|
56 | // "public-private methods"
|
---|
57 | void i_flushQueuedSettings();
|
---|
58 |
|
---|
59 | private:
|
---|
60 |
|
---|
61 | // wrapped IMachineDeugger properties
|
---|
62 | HRESULT getSingleStep(BOOL *aSingleStep);
|
---|
63 | HRESULT setSingleStep(BOOL aSingleStep);
|
---|
64 | HRESULT getExecuteAllInIEM(BOOL *aExecuteAllInIEM);
|
---|
65 | HRESULT setExecuteAllInIEM(BOOL aExecuteAllInIEM);
|
---|
66 | HRESULT getLogEnabled(BOOL *aLogEnabled);
|
---|
67 | HRESULT setLogEnabled(BOOL aLogEnabled);
|
---|
68 | HRESULT getLogDbgFlags(com::Utf8Str &aLogDbgFlags);
|
---|
69 | HRESULT getLogDbgGroups(com::Utf8Str &aLogDbgGroups);
|
---|
70 | HRESULT getLogDbgDestinations(com::Utf8Str &aLogDbgDestinations);
|
---|
71 | HRESULT getLogRelFlags(com::Utf8Str &aLogRelFlags);
|
---|
72 | HRESULT getLogRelGroups(com::Utf8Str &aLogRelGroups);
|
---|
73 | HRESULT getLogRelDestinations(com::Utf8Str &aLogRelDestinations);
|
---|
74 | HRESULT getExecutionEngine(VMExecutionEngine_T *apenmEngine);
|
---|
75 | HRESULT getHWVirtExNestedPagingEnabled(BOOL *aHWVirtExNestedPagingEnabled);
|
---|
76 | HRESULT getHWVirtExVPIDEnabled(BOOL *aHWVirtExVPIDEnabled);
|
---|
77 | HRESULT getHWVirtExUXEnabled(BOOL *aHWVirtExUXEnabled);
|
---|
78 | HRESULT getOSName(com::Utf8Str &aOSName);
|
---|
79 | HRESULT getOSVersion(com::Utf8Str &aOSVersion);
|
---|
80 | HRESULT getPAEEnabled(BOOL *aPAEEnabled);
|
---|
81 | HRESULT getVirtualTimeRate(ULONG *aVirtualTimeRate);
|
---|
82 | HRESULT setVirtualTimeRate(ULONG aVirtualTimeRate);
|
---|
83 | HRESULT getUptime(LONG64 *aUptime);
|
---|
84 |
|
---|
85 | // wrapped IMachineDeugger methods
|
---|
86 | HRESULT dumpGuestCore(const com::Utf8Str &aFilename,
|
---|
87 | const com::Utf8Str &aCompression);
|
---|
88 | HRESULT dumpHostProcessCore(const com::Utf8Str &aFilename,
|
---|
89 | const com::Utf8Str &aCompression);
|
---|
90 | HRESULT info(const com::Utf8Str &aName,
|
---|
91 | const com::Utf8Str &aArgs,
|
---|
92 | com::Utf8Str &aInfo);
|
---|
93 | HRESULT injectNMI();
|
---|
94 | HRESULT modifyLogGroups(const com::Utf8Str &aSettings);
|
---|
95 | HRESULT modifyLogFlags(const com::Utf8Str &aSettings);
|
---|
96 | HRESULT modifyLogDestinations(const com::Utf8Str &aSettings);
|
---|
97 | HRESULT readPhysicalMemory(LONG64 aAddress,
|
---|
98 | ULONG aSize,
|
---|
99 | std::vector<BYTE> &aBytes);
|
---|
100 | HRESULT writePhysicalMemory(LONG64 aAddress,
|
---|
101 | ULONG aSize,
|
---|
102 | const std::vector<BYTE> &aBytes);
|
---|
103 | HRESULT readVirtualMemory(ULONG aCpuId,
|
---|
104 | LONG64 aAddress,
|
---|
105 | ULONG aSize,
|
---|
106 | std::vector<BYTE> &aBytes);
|
---|
107 | HRESULT writeVirtualMemory(ULONG aCpuId,
|
---|
108 | LONG64 aAddress,
|
---|
109 | ULONG aSize,
|
---|
110 | const std::vector<BYTE> &aBytes);
|
---|
111 | HRESULT loadPlugIn(const com::Utf8Str &aName,
|
---|
112 | com::Utf8Str &aPlugInName);
|
---|
113 | HRESULT unloadPlugIn(const com::Utf8Str &aName);
|
---|
114 | HRESULT detectOS(com::Utf8Str &aOs);
|
---|
115 | HRESULT queryOSKernelLog(ULONG aMaxMessages,
|
---|
116 | com::Utf8Str &aDmesg);
|
---|
117 | HRESULT getRegister(ULONG aCpuId,
|
---|
118 | const com::Utf8Str &aName,
|
---|
119 | com::Utf8Str &aValue);
|
---|
120 | HRESULT getRegisters(ULONG aCpuId,
|
---|
121 | std::vector<com::Utf8Str> &aNames,
|
---|
122 | std::vector<com::Utf8Str> &aValues);
|
---|
123 | HRESULT setRegister(ULONG aCpuId,
|
---|
124 | const com::Utf8Str &aName,
|
---|
125 | const com::Utf8Str &aValue);
|
---|
126 | HRESULT setRegisters(ULONG aCpuId,
|
---|
127 | const std::vector<com::Utf8Str> &aNames,
|
---|
128 | const std::vector<com::Utf8Str> &aValues);
|
---|
129 | HRESULT dumpGuestStack(ULONG aCpuId,
|
---|
130 | com::Utf8Str &aStack);
|
---|
131 | HRESULT resetStats(const com::Utf8Str &aPattern);
|
---|
132 | HRESULT dumpStats(const com::Utf8Str &aPattern);
|
---|
133 | HRESULT getStats(const com::Utf8Str &aPattern,
|
---|
134 | BOOL aWithDescriptions,
|
---|
135 | com::Utf8Str &aStats);
|
---|
136 | HRESULT getCPULoad(ULONG aCpuId, ULONG *aPctExecuting, ULONG *aPctHalted, ULONG *aPctOther, LONG64 *aMsInterval) RT_OVERRIDE;
|
---|
137 | HRESULT takeGuestSample(const com::Utf8Str &aFilename, ULONG aUsInterval, LONG64 aUsSampleTime, ComPtr<IProgress> &pProgress);
|
---|
138 | HRESULT getUVMAndVMMFunctionTable(LONG64 aMagicVersion, LONG64 *aVMMFunctionTable, LONG64 *aUVM);
|
---|
139 |
|
---|
140 | // private methods
|
---|
141 | bool i_queueSettings() const;
|
---|
142 | HRESULT i_getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced);
|
---|
143 | HRESULT i_setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce);
|
---|
144 |
|
---|
145 | /** RTLogGetFlags, RTLogGetGroupSettings and RTLogGetDestinations function. */
|
---|
146 | typedef DECLCALLBACKTYPE(int, FNLOGGETSTR,(PRTLOGGER, char *, size_t));
|
---|
147 | /** Function pointer. */
|
---|
148 | typedef FNLOGGETSTR *PFNLOGGETSTR;
|
---|
149 | HRESULT i_logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, Utf8Str *pstrSettings);
|
---|
150 |
|
---|
151 | static DECLCALLBACK(int) i_dbgfProgressCallback(void *pvUser, unsigned uPercentage);
|
---|
152 |
|
---|
153 | Console * const mParent;
|
---|
154 | /** @name Flags whether settings have been queued because they could not be sent
|
---|
155 | * to the VM (not up yet, etc.)
|
---|
156 | * @{ */
|
---|
157 | uint8_t maiQueuedEmExecPolicyParams[EMEXECPOLICY_END];
|
---|
158 | int mSingleStepQueued;
|
---|
159 | int mLogEnabledQueued;
|
---|
160 | uint32_t mVirtualTimeRateQueued;
|
---|
161 | bool mFlushMode;
|
---|
162 | /** @} */
|
---|
163 |
|
---|
164 | /** @name Sample report related things.
|
---|
165 | * @{ */
|
---|
166 | /** Sample report handle. */
|
---|
167 | DBGFSAMPLEREPORT m_hSampleReport;
|
---|
168 | /** Progress object for the currently taken guest sample. */
|
---|
169 | ComObjPtr<Progress> m_Progress;
|
---|
170 | /** Filename to dump the report to. */
|
---|
171 | com::Utf8Str m_strFilename;
|
---|
172 | /** @} */
|
---|
173 | };
|
---|
174 |
|
---|
175 | #endif /* !MAIN_INCLUDED_MachineDebuggerImpl_h */
|
---|
176 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|