summaryrefslogtreecommitdiff
path: root/src/VBox/Main/include/MachineDebuggerImpl.h
blob: ab5a6b658df8965f22597455c7afa7df183300d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* $Id: MachineDebuggerImpl.h $ */

/** @file
 *
 * VirtualBox COM class implementation
 */

/*
 * Copyright (C) 2006-2012 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef ____H_MACHINEDEBUGGER
#define ____H_MACHINEDEBUGGER

#include "VirtualBoxBase.h"
#include <iprt/log.h>
#include <VBox/vmm/em.h>

class Console;

class ATL_NO_VTABLE MachineDebugger :
    public VirtualBoxBase,
    VBOX_SCRIPTABLE_IMPL(IMachineDebugger)
{
public:

    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (MachineDebugger, IMachineDebugger)

    DECLARE_NOT_AGGREGATABLE (MachineDebugger)

    DECLARE_PROTECT_FINAL_CONSTRUCT()

    BEGIN_COM_MAP(MachineDebugger)
        VBOX_DEFAULT_INTERFACE_ENTRIES (IMachineDebugger)
    END_COM_MAP()

    DECLARE_EMPTY_CTOR_DTOR (MachineDebugger)

    HRESULT FinalConstruct();
    void FinalRelease();

    // public initializer/uninitializer for internal purposes only
    HRESULT init (Console *aParent);
    void uninit();

    // IMachineDebugger properties
    STDMETHOD(COMGETTER(SingleStep))(BOOL *a_pfEnabled);
    STDMETHOD(COMSETTER(SingleStep))(BOOL a_fEnable);
    STDMETHOD(COMGETTER(RecompileUser))(BOOL *a_pfEnabled);
    STDMETHOD(COMSETTER(RecompileUser))(BOOL a_fEnable);
    STDMETHOD(COMGETTER(RecompileSupervisor))(BOOL *a_pfEnabled);
    STDMETHOD(COMSETTER(RecompileSupervisor))(BOOL a_fEnable);
    STDMETHOD(COMGETTER(ExecuteAllInIEM))(BOOL *a_pfEnabled);
    STDMETHOD(COMSETTER(ExecuteAllInIEM))(BOOL a_fEnable);
    STDMETHOD(COMGETTER(PATMEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMSETTER(PATMEnabled))(BOOL a_fEnable);
    STDMETHOD(COMGETTER(CSAMEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMSETTER(CSAMEnabled))(BOOL a_fEnable);
    STDMETHOD(COMGETTER(LogEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMSETTER(LogEnabled))(BOOL a_fEnable);
    STDMETHOD(COMGETTER(LogDbgFlags))(BSTR *a_pbstrSettings);
    STDMETHOD(COMGETTER(LogDbgGroups))(BSTR *a_pbstrSettings);
    STDMETHOD(COMGETTER(LogDbgDestinations))(BSTR *a_pbstrSettings);
    STDMETHOD(COMGETTER(LogRelFlags))(BSTR *a_pbstrSettings);
    STDMETHOD(COMGETTER(LogRelGroups))(BSTR *a_pbstrSettings);
    STDMETHOD(COMGETTER(LogRelDestinations))(BSTR *a_pbstrSettings);
    STDMETHOD(COMGETTER(HWVirtExEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMGETTER(HWVirtExVPIDEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMGETTER(HWVirtExUXEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMGETTER(PAEEnabled))(BOOL *a_pfEnabled);
    STDMETHOD(COMGETTER(OSName))(BSTR *a_pbstrName);
    STDMETHOD(COMGETTER(OSVersion))(BSTR *a_pbstrVersion);
    STDMETHOD(COMGETTER(VirtualTimeRate))(ULONG *a_puPct);
    STDMETHOD(COMSETTER(VirtualTimeRate))(ULONG a_uPct);
    STDMETHOD(COMGETTER(VM))(LONG64 *a_u64Vm);

    // IMachineDebugger methods
    STDMETHOD(DumpGuestCore)(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression);
    STDMETHOD(DumpHostProcessCore)(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression);
    STDMETHOD(Info)(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR *a_bstrInfo);
    STDMETHOD(InjectNMI)();
    STDMETHOD(ModifyLogFlags)(IN_BSTR a_bstrSettings);
    STDMETHOD(ModifyLogGroups)(IN_BSTR a_bstrSettings);
    STDMETHOD(ModifyLogDestinations)(IN_BSTR a_bstrSettings);
    STDMETHOD(ReadPhysicalMemory)(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData));
    STDMETHOD(WritePhysicalMemory)(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData));
    STDMETHOD(ReadVirtualMemory)(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData));
    STDMETHOD(WriteVirtualMemory)(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData));
    STDMETHOD(DetectOS)(BSTR *a_pbstrName);
    STDMETHOD(GetRegister)(ULONG a_idCpu, IN_BSTR a_bstrName, BSTR *a_pbstrValue);
    STDMETHOD(GetRegisters)(ULONG a_idCpu, ComSafeArrayOut(BSTR, a_bstrNames), ComSafeArrayOut(BSTR, a_bstrValues));
    STDMETHOD(SetRegister)(ULONG a_idCpu, IN_BSTR a_bstrName, IN_BSTR a_bstrValue);
    STDMETHOD(SetRegisters)(ULONG a_idCpu, ComSafeArrayIn(IN_BSTR, a_bstrNames), ComSafeArrayIn(IN_BSTR, a_bstrValues));
    STDMETHOD(DumpGuestStack)(ULONG a_idCpu, BSTR *a_pbstrStack);
    STDMETHOD(ResetStats)(IN_BSTR aPattern);
    STDMETHOD(DumpStats)(IN_BSTR aPattern);
    STDMETHOD(GetStats)(IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats);


    // "public-private methods"
    void flushQueuedSettings();

private:
    // private methods
    bool queueSettings() const;
    HRESULT getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced);
    HRESULT setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce);

    /** RTLogGetFlags, RTLogGetGroupSettings and RTLogGetDestinations function. */
    typedef DECLCALLBACK(int) FNLOGGETSTR(PRTLOGGER, char *, size_t);
    /** Function pointer.  */
    typedef FNLOGGETSTR *PFNLOGGETSTR;
    HRESULT logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, BSTR *a_bstrSettings);

    Console * const mParent;
    /** @name Flags whether settings have been queued because they could not be sent
     *        to the VM (not up yet, etc.)
     * @{ */
    uint8_t maiQueuedEmExecPolicyParams[EMEXECPOLICY_END];
    int mSingleStepQueued;
    int mRecompileUserQueued;
    int mRecompileSupervisorQueued;
    int mPatmEnabledQueued;
    int mCsamEnabledQueued;
    int mLogEnabledQueued;
    uint32_t mVirtualTimeRateQueued;
    bool mFlushMode;
    /** @}  */
};

#endif /* !____H_MACHINEDEBUGGER */
/* vi: set tabstop=4 shiftwidth=4 expandtab: */