VirtualBox

source: vbox/trunk/src/VBox/Main/include/MachineDebuggerImpl.h@ 90441

Last change on this file since 90441 was 89696, checked in by vboxsync, 3 years ago

Main/MachineDebugger: Implement API for taking a guest sample, bugref:10025

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1/* $Id: MachineDebuggerImpl.h 89696 2021-06-15 09:53:06Z 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
28class Console;
29class Progress;
30
31class ATL_NO_VTABLE MachineDebugger :
32 public MachineDebuggerWrap
33{
34
35public:
36
37 DECLARE_EMPTY_CTOR_DTOR (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
49private:
50
51 // wrapped IMachineDeugger properties
52 HRESULT getSingleStep(BOOL *aSingleStep);
53 HRESULT setSingleStep(BOOL aSingleStep);
54 HRESULT getRecompileUser(BOOL *aRecompileUser);
55 HRESULT setRecompileUser(BOOL aRecompileUser);
56 HRESULT getRecompileSupervisor(BOOL *aRecompileSupervisor);
57 HRESULT setRecompileSupervisor(BOOL aRecompileSupervisor);
58 HRESULT getExecuteAllInIEM(BOOL *aExecuteAllInIEM);
59 HRESULT setExecuteAllInIEM(BOOL aExecuteAllInIEM);
60 HRESULT getPATMEnabled(BOOL *aPATMEnabled);
61 HRESULT setPATMEnabled(BOOL aPATMEnabled);
62 HRESULT getCSAMEnabled(BOOL *aCSAMEnabled);
63 HRESULT setCSAMEnabled(BOOL aCSAMEnabled);
64 HRESULT getLogEnabled(BOOL *aLogEnabled);
65 HRESULT setLogEnabled(BOOL aLogEnabled);
66 HRESULT getLogDbgFlags(com::Utf8Str &aLogDbgFlags);
67 HRESULT getLogDbgGroups(com::Utf8Str &aLogDbgGroups);
68 HRESULT getLogDbgDestinations(com::Utf8Str &aLogDbgDestinations);
69 HRESULT getLogRelFlags(com::Utf8Str &aLogRelFlags);
70 HRESULT getLogRelGroups(com::Utf8Str &aLogRelGroups);
71 HRESULT getLogRelDestinations(com::Utf8Str &aLogRelDestinations);
72 HRESULT getExecutionEngine(VMExecutionEngine_T *apenmEngine);
73 HRESULT getHWVirtExEnabled(BOOL *aHWVirtExEnabled);
74 HRESULT getHWVirtExNestedPagingEnabled(BOOL *aHWVirtExNestedPagingEnabled);
75 HRESULT getHWVirtExVPIDEnabled(BOOL *aHWVirtExVPIDEnabled);
76 HRESULT getHWVirtExUXEnabled(BOOL *aHWVirtExUXEnabled);
77 HRESULT getOSName(com::Utf8Str &aOSName);
78 HRESULT getOSVersion(com::Utf8Str &aOSVersion);
79 HRESULT getPAEEnabled(BOOL *aPAEEnabled);
80 HRESULT getVirtualTimeRate(ULONG *aVirtualTimeRate);
81 HRESULT setVirtualTimeRate(ULONG aVirtualTimeRate);
82 HRESULT getVM(LONG64 *aVM);
83 HRESULT getUptime(LONG64 *aUptime);
84
85 // wrapped IMachineDeugger properties
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
139 // private methods
140 bool i_queueSettings() const;
141 HRESULT i_getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced);
142 HRESULT i_setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce);
143
144 /** RTLogGetFlags, RTLogGetGroupSettings and RTLogGetDestinations function. */
145 typedef DECLCALLBACKTYPE(int, FNLOGGETSTR,(PRTLOGGER, char *, size_t));
146 /** Function pointer. */
147 typedef FNLOGGETSTR *PFNLOGGETSTR;
148 HRESULT i_logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, Utf8Str *pstrSettings);
149
150 static DECLCALLBACK(int) i_dbgfProgressCallback(void *pvUser, unsigned uPercentage);
151
152 Console * const mParent;
153 /** @name Flags whether settings have been queued because they could not be sent
154 * to the VM (not up yet, etc.)
155 * @{ */
156 uint8_t maiQueuedEmExecPolicyParams[EMEXECPOLICY_END];
157 int mSingleStepQueued;
158 int mRecompileUserQueued;
159 int mRecompileSupervisorQueued;
160 int mPatmEnabledQueued;
161 int mCsamEnabledQueued;
162 int mLogEnabledQueued;
163 uint32_t mVirtualTimeRateQueued;
164 bool mFlushMode;
165 /** @} */
166
167 /** @name Sample report related things.
168 * @{ */
169 /** Sample report handle. */
170 DBGFSAMPLEREPORT m_hSampleReport;
171 /** Progress object for the currently taken guest sample. */
172 ComObjPtr<Progress> m_Progress;
173 /** Filename to dump the report to. */
174 com::Utf8Str m_strFilename;
175 /** @} */
176};
177
178#endif /* !MAIN_INCLUDED_MachineDebuggerImpl_h */
179/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette