1 | /* $Id: MachineDebuggerImpl.h 85121 2020-07-08 19:33:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 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 |
|
---|
30 | class ATL_NO_VTABLE MachineDebugger :
|
---|
31 | public MachineDebuggerWrap
|
---|
32 | {
|
---|
33 |
|
---|
34 | public:
|
---|
35 |
|
---|
36 | DECLARE_EMPTY_CTOR_DTOR (MachineDebugger)
|
---|
37 |
|
---|
38 | HRESULT FinalConstruct();
|
---|
39 | void FinalRelease();
|
---|
40 |
|
---|
41 | // public initializer/uninitializer for internal purposes only
|
---|
42 | HRESULT init (Console *aParent);
|
---|
43 | void uninit();
|
---|
44 |
|
---|
45 | // "public-private methods"
|
---|
46 | void i_flushQueuedSettings();
|
---|
47 |
|
---|
48 | private:
|
---|
49 |
|
---|
50 | // wrapped IMachineDeugger properties
|
---|
51 | HRESULT getSingleStep(BOOL *aSingleStep);
|
---|
52 | HRESULT setSingleStep(BOOL aSingleStep);
|
---|
53 | HRESULT getRecompileUser(BOOL *aRecompileUser);
|
---|
54 | HRESULT setRecompileUser(BOOL aRecompileUser);
|
---|
55 | HRESULT getRecompileSupervisor(BOOL *aRecompileSupervisor);
|
---|
56 | HRESULT setRecompileSupervisor(BOOL aRecompileSupervisor);
|
---|
57 | HRESULT getExecuteAllInIEM(BOOL *aExecuteAllInIEM);
|
---|
58 | HRESULT setExecuteAllInIEM(BOOL aExecuteAllInIEM);
|
---|
59 | HRESULT getPATMEnabled(BOOL *aPATMEnabled);
|
---|
60 | HRESULT setPATMEnabled(BOOL aPATMEnabled);
|
---|
61 | HRESULT getCSAMEnabled(BOOL *aCSAMEnabled);
|
---|
62 | HRESULT setCSAMEnabled(BOOL aCSAMEnabled);
|
---|
63 | HRESULT getLogEnabled(BOOL *aLogEnabled);
|
---|
64 | HRESULT setLogEnabled(BOOL aLogEnabled);
|
---|
65 | HRESULT getLogDbgFlags(com::Utf8Str &aLogDbgFlags);
|
---|
66 | HRESULT getLogDbgGroups(com::Utf8Str &aLogDbgGroups);
|
---|
67 | HRESULT getLogDbgDestinations(com::Utf8Str &aLogDbgDestinations);
|
---|
68 | HRESULT getLogRelFlags(com::Utf8Str &aLogRelFlags);
|
---|
69 | HRESULT getLogRelGroups(com::Utf8Str &aLogRelGroups);
|
---|
70 | HRESULT getLogRelDestinations(com::Utf8Str &aLogRelDestinations);
|
---|
71 | HRESULT getExecutionEngine(VMExecutionEngine_T *apenmEngine);
|
---|
72 | HRESULT getHWVirtExEnabled(BOOL *aHWVirtExEnabled);
|
---|
73 | HRESULT getHWVirtExNestedPagingEnabled(BOOL *aHWVirtExNestedPagingEnabled);
|
---|
74 | HRESULT getHWVirtExVPIDEnabled(BOOL *aHWVirtExVPIDEnabled);
|
---|
75 | HRESULT getHWVirtExUXEnabled(BOOL *aHWVirtExUXEnabled);
|
---|
76 | HRESULT getOSName(com::Utf8Str &aOSName);
|
---|
77 | HRESULT getOSVersion(com::Utf8Str &aOSVersion);
|
---|
78 | HRESULT getPAEEnabled(BOOL *aPAEEnabled);
|
---|
79 | HRESULT getVirtualTimeRate(ULONG *aVirtualTimeRate);
|
---|
80 | HRESULT setVirtualTimeRate(ULONG aVirtualTimeRate);
|
---|
81 | HRESULT getVM(LONG64 *aVM);
|
---|
82 | HRESULT getUptime(LONG64 *aUptime);
|
---|
83 |
|
---|
84 | // wrapped IMachineDeugger properties
|
---|
85 | HRESULT dumpGuestCore(const com::Utf8Str &aFilename,
|
---|
86 | const com::Utf8Str &aCompression);
|
---|
87 | HRESULT dumpHostProcessCore(const com::Utf8Str &aFilename,
|
---|
88 | const com::Utf8Str &aCompression);
|
---|
89 | HRESULT info(const com::Utf8Str &aName,
|
---|
90 | const com::Utf8Str &aArgs,
|
---|
91 | com::Utf8Str &aInfo);
|
---|
92 | HRESULT injectNMI();
|
---|
93 | HRESULT modifyLogGroups(const com::Utf8Str &aSettings);
|
---|
94 | HRESULT modifyLogFlags(const com::Utf8Str &aSettings);
|
---|
95 | HRESULT modifyLogDestinations(const com::Utf8Str &aSettings);
|
---|
96 | HRESULT readPhysicalMemory(LONG64 aAddress,
|
---|
97 | ULONG aSize,
|
---|
98 | std::vector<BYTE> &aBytes);
|
---|
99 | HRESULT writePhysicalMemory(LONG64 aAddress,
|
---|
100 | ULONG aSize,
|
---|
101 | const std::vector<BYTE> &aBytes);
|
---|
102 | HRESULT readVirtualMemory(ULONG aCpuId,
|
---|
103 | LONG64 aAddress,
|
---|
104 | ULONG aSize,
|
---|
105 | std::vector<BYTE> &aBytes);
|
---|
106 | HRESULT writeVirtualMemory(ULONG aCpuId,
|
---|
107 | LONG64 aAddress,
|
---|
108 | ULONG aSize,
|
---|
109 | const std::vector<BYTE> &aBytes);
|
---|
110 | HRESULT loadPlugIn(const com::Utf8Str &aName,
|
---|
111 | com::Utf8Str &aPlugInName);
|
---|
112 | HRESULT unloadPlugIn(const com::Utf8Str &aName);
|
---|
113 | HRESULT detectOS(com::Utf8Str &aOs);
|
---|
114 | HRESULT queryOSKernelLog(ULONG aMaxMessages,
|
---|
115 | com::Utf8Str &aDmesg);
|
---|
116 | HRESULT getRegister(ULONG aCpuId,
|
---|
117 | const com::Utf8Str &aName,
|
---|
118 | com::Utf8Str &aValue);
|
---|
119 | HRESULT getRegisters(ULONG aCpuId,
|
---|
120 | std::vector<com::Utf8Str> &aNames,
|
---|
121 | std::vector<com::Utf8Str> &aValues);
|
---|
122 | HRESULT setRegister(ULONG aCpuId,
|
---|
123 | const com::Utf8Str &aName,
|
---|
124 | const com::Utf8Str &aValue);
|
---|
125 | HRESULT setRegisters(ULONG aCpuId,
|
---|
126 | const std::vector<com::Utf8Str> &aNames,
|
---|
127 | const std::vector<com::Utf8Str> &aValues);
|
---|
128 | HRESULT dumpGuestStack(ULONG aCpuId,
|
---|
129 | com::Utf8Str &aStack);
|
---|
130 | HRESULT resetStats(const com::Utf8Str &aPattern);
|
---|
131 | HRESULT dumpStats(const com::Utf8Str &aPattern);
|
---|
132 | HRESULT getStats(const com::Utf8Str &aPattern,
|
---|
133 | BOOL aWithDescriptions,
|
---|
134 | com::Utf8Str &aStats);
|
---|
135 | HRESULT getCPULoad(ULONG aCpuId, ULONG *aPctExecuting, ULONG *aPctHalted, ULONG *aPctOther, LONG64 *aMsInterval) RT_OVERRIDE;
|
---|
136 |
|
---|
137 | // private methods
|
---|
138 | bool i_queueSettings() const;
|
---|
139 | HRESULT i_getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced);
|
---|
140 | HRESULT i_setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce);
|
---|
141 |
|
---|
142 | /** RTLogGetFlags, RTLogGetGroupSettings and RTLogGetDestinations function. */
|
---|
143 | typedef DECLCALLBACKTYPE(int, FNLOGGETSTR,(PRTLOGGER, char *, size_t));
|
---|
144 | /** Function pointer. */
|
---|
145 | typedef FNLOGGETSTR *PFNLOGGETSTR;
|
---|
146 | HRESULT i_logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, Utf8Str *pstrSettings);
|
---|
147 |
|
---|
148 | Console * const mParent;
|
---|
149 | /** @name Flags whether settings have been queued because they could not be sent
|
---|
150 | * to the VM (not up yet, etc.)
|
---|
151 | * @{ */
|
---|
152 | uint8_t maiQueuedEmExecPolicyParams[EMEXECPOLICY_END];
|
---|
153 | int mSingleStepQueued;
|
---|
154 | int mRecompileUserQueued;
|
---|
155 | int mRecompileSupervisorQueued;
|
---|
156 | int mPatmEnabledQueued;
|
---|
157 | int mCsamEnabledQueued;
|
---|
158 | int mLogEnabledQueued;
|
---|
159 | uint32_t mVirtualTimeRateQueued;
|
---|
160 | bool mFlushMode;
|
---|
161 | /** @} */
|
---|
162 | };
|
---|
163 |
|
---|
164 | #endif /* !MAIN_INCLUDED_MachineDebuggerImpl_h */
|
---|
165 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|