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