1 | /* $Id: VBoxDbgGui.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Debugger GUI - The Manager.
|
---|
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 DEBUGGER_INCLUDED_SRC_VBoxDbgGui_h
|
---|
29 | #define DEBUGGER_INCLUDED_SRC_VBoxDbgGui_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | // VirtualBox COM interfaces declarations (generated header)
|
---|
35 | #ifdef VBOX_WITH_XPCOM
|
---|
36 | # include <VirtualBox_XPCOM.h>
|
---|
37 | #else
|
---|
38 | # include <iprt/win/windows.h> /* Include via cleanup wrapper before VirtualBox.h includes it via rpc.h. */
|
---|
39 | # include <VirtualBox.h>
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include "VBoxDbgStatsQt.h"
|
---|
43 | #include "VBoxDbgConsole.h"
|
---|
44 |
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * The Debugger GUI manager class.
|
---|
48 | *
|
---|
49 | * It's job is to provide a C callable external interface and manage the
|
---|
50 | * windows and bit making up the debugger GUI.
|
---|
51 | */
|
---|
52 | class VBoxDbgGui : public QObject
|
---|
53 | {
|
---|
54 | Q_OBJECT;
|
---|
55 |
|
---|
56 | public:
|
---|
57 | /**
|
---|
58 | * Create a default VBoxDbgGui object.
|
---|
59 | */
|
---|
60 | VBoxDbgGui();
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Initializes a VBoxDbgGui object by ISession.
|
---|
64 | *
|
---|
65 | * @returns VBox status code.
|
---|
66 | * @param pSession VBox Session object.
|
---|
67 | */
|
---|
68 | int init(ISession *pSession);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Initializes a VBoxDbgGui object by VM handle.
|
---|
72 | *
|
---|
73 | * @returns VBox status code.
|
---|
74 | * @param pUVM The user mode VM handle. The caller's reference will be
|
---|
75 | * consumed on success.
|
---|
76 | * @param pVMM The VMM function table.
|
---|
77 | */
|
---|
78 | int init(PUVM pUVM, PCVMMR3VTABLE pVMM);
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Destroys the VBoxDbgGui object.
|
---|
82 | */
|
---|
83 | virtual ~VBoxDbgGui();
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Sets the parent widget.
|
---|
87 | *
|
---|
88 | * @param pParent New parent widget.
|
---|
89 | * @remarks This only affects new windows.
|
---|
90 | */
|
---|
91 | void setParent(QWidget *pParent);
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Sets the menu object.
|
---|
95 | *
|
---|
96 | * @param pMenu New menu object.
|
---|
97 | * @remarks This only affects new menu additions.
|
---|
98 | */
|
---|
99 | void setMenu(QMenu *pMenu);
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Show the default statistics window, creating it if necessary.
|
---|
103 | *
|
---|
104 | * @returns VBox status code.
|
---|
105 | * @param pszFilter Filter pattern.
|
---|
106 | * @param pszExpand Expand pattern.
|
---|
107 | */
|
---|
108 | int showStatistics(const char *pszFilter, const char *pszExpand);
|
---|
109 |
|
---|
110 | /**
|
---|
111 | * Repositions and resizes (optionally) the statistics to its defaults
|
---|
112 | *
|
---|
113 | * @param fResize If set (default) the size of window is also changed.
|
---|
114 | */
|
---|
115 | void repositionStatistics(bool fResize = true);
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Show the console window (aka. command line), creating it if necessary.
|
---|
119 | *
|
---|
120 | * @returns VBox status code.
|
---|
121 | */
|
---|
122 | int showConsole();
|
---|
123 |
|
---|
124 | /**
|
---|
125 | * Repositions and resizes (optionally) the console to its defaults
|
---|
126 | *
|
---|
127 | * @param fResize If set (default) the size of window is also changed.
|
---|
128 | */
|
---|
129 | void repositionConsole(bool fResize = true);
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * Update the desktop size.
|
---|
133 | * This is called whenever the reference window changes position.
|
---|
134 | */
|
---|
135 | void updateDesktopSize();
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * Notifies the debugger GUI that the console window (or whatever) has changed
|
---|
139 | * size or position.
|
---|
140 | *
|
---|
141 | * @param x The x-coordinate of the window the debugger is relative to.
|
---|
142 | * @param y The y-coordinate of the window the debugger is relative to.
|
---|
143 | * @param cx The width of the window the debugger is relative to.
|
---|
144 | * @param cy The height of the window the debugger is relative to.
|
---|
145 | */
|
---|
146 | void adjustRelativePos(int x, int y, unsigned cx, unsigned cy);
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Gets the user mode VM handle.
|
---|
150 | * @returns The UVM handle.
|
---|
151 | */
|
---|
152 | PUVM getUvmHandle() const
|
---|
153 | {
|
---|
154 | return m_pUVM;
|
---|
155 | }
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * Gets the VMM function table.
|
---|
159 | * @returns The VMM function table.
|
---|
160 | */
|
---|
161 | PCVMMR3VTABLE getVMMFunctionTable() const
|
---|
162 | {
|
---|
163 | return m_pVMM;
|
---|
164 | }
|
---|
165 |
|
---|
166 | /**
|
---|
167 | * @returns The name of the machine.
|
---|
168 | */
|
---|
169 | QString getMachineName() const;
|
---|
170 |
|
---|
171 | protected slots:
|
---|
172 | /**
|
---|
173 | * Notify that a child object (i.e. a window is begin destroyed).
|
---|
174 | * @param pObj The object which is being destroyed.
|
---|
175 | */
|
---|
176 | void notifyChildDestroyed(QObject *pObj);
|
---|
177 |
|
---|
178 | protected:
|
---|
179 |
|
---|
180 | /** The debugger statistics. */
|
---|
181 | VBoxDbgStats *m_pDbgStats;
|
---|
182 | /** The debugger console (aka. command line). */
|
---|
183 | VBoxDbgConsole *m_pDbgConsole;
|
---|
184 |
|
---|
185 | /** The VirtualBox session. */
|
---|
186 | ISession *m_pSession;
|
---|
187 | /** The VirtualBox console. */
|
---|
188 | IConsole *m_pConsole;
|
---|
189 | /** The VirtualBox Machine Debugger. */
|
---|
190 | IMachineDebugger *m_pMachineDebugger;
|
---|
191 | /** The VirtualBox Machine. */
|
---|
192 | IMachine *m_pMachine;
|
---|
193 | /** The VM instance. */
|
---|
194 | PVM m_pVM;
|
---|
195 | /** The user mode VM handle. */
|
---|
196 | PUVM m_pUVM;
|
---|
197 | /** The VMM function table. */
|
---|
198 | PCVMMR3VTABLE m_pVMM;
|
---|
199 |
|
---|
200 | /** The parent widget. */
|
---|
201 | QWidget *m_pParent;
|
---|
202 | /** The menu object for the 'debug' menu. */
|
---|
203 | QMenu *m_pMenu;
|
---|
204 |
|
---|
205 | /** The x-coordinate of the window we're relative to. */
|
---|
206 | int m_x;
|
---|
207 | /** The y-coordinate of the window we're relative to. */
|
---|
208 | int m_y;
|
---|
209 | /** The width of the window we're relative to. */
|
---|
210 | unsigned m_cx;
|
---|
211 | /** The height of the window we're relative to. */
|
---|
212 | unsigned m_cy;
|
---|
213 | /** The x-coordinate of the desktop. */
|
---|
214 | int m_xDesktop;
|
---|
215 | /** The y-coordinate of the desktop. */
|
---|
216 | int m_yDesktop;
|
---|
217 | /** The size of the desktop. */
|
---|
218 | unsigned m_cxDesktop;
|
---|
219 | /** The size of the desktop. */
|
---|
220 | unsigned m_cyDesktop;
|
---|
221 | };
|
---|
222 |
|
---|
223 |
|
---|
224 | #endif /* !DEBUGGER_INCLUDED_SRC_VBoxDbgGui_h */
|
---|
225 |
|
---|