1 | /* $Id: VBoxDbgGui.h 103464 2024-02-20 02:35:20Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Debugger GUI - The Manager.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 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 | * @param pszConfig Advanced filter configuration (min/max/regexp on
|
---|
108 | * sub-trees) and more.
|
---|
109 | */
|
---|
110 | int showStatistics(const char *pszFilter, const char *pszExpand, const char *pszConfig);
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Show the console window (aka. command line), creating it if necessary.
|
---|
114 | *
|
---|
115 | * @returns VBox status code.
|
---|
116 | */
|
---|
117 | int showConsole();
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Update the desktop size.
|
---|
121 | * This is called whenever the reference window changes position.
|
---|
122 | */
|
---|
123 | void updateDesktopSize();
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * Repositions and maybe resizes a window according to the VM window.
|
---|
127 | *
|
---|
128 | * @param a_pWindow The window. Ignored if NULL.
|
---|
129 | * @param a_fResize If set (default) the size of window is also changed.
|
---|
130 | */
|
---|
131 | void repositionWindow(VBoxDbgBaseWindow *a_pWindow, bool a_fResize = true);
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * Does the initial repositioning and sizing of a window.
|
---|
135 | *
|
---|
136 | * This may get preferences from extra data.
|
---|
137 | *
|
---|
138 | * @param a_pWindow The window.
|
---|
139 | * @param a_pszSettings The 'section' name in the settings.
|
---|
140 | * @param a_enmDefaultAttraction The default attraction of the window.
|
---|
141 | */
|
---|
142 | void repositionWindowInitial(VBoxDbgBaseWindow *a_pWindow, const char *a_pszSettings,
|
---|
143 | VBoxDbgBaseWindow::VBoxDbgAttractionType a_enmDefaultAttraction);
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * Notifies the debugger GUI that the console window (or whatever) has changed
|
---|
147 | * size or position.
|
---|
148 | *
|
---|
149 | * @param x The x-coordinate of the window the debugger is relative to.
|
---|
150 | * @param y The y-coordinate of the window the debugger is relative to.
|
---|
151 | * @param cx The width of the window the debugger is relative to.
|
---|
152 | * @param cy The height of the window the debugger is relative to.
|
---|
153 | */
|
---|
154 | void adjustRelativePos(int x, int y, unsigned cx, unsigned cy);
|
---|
155 |
|
---|
156 | /**
|
---|
157 | * Gets the user mode VM handle.
|
---|
158 | * @returns The UVM handle.
|
---|
159 | */
|
---|
160 | PUVM getUvmHandle() const
|
---|
161 | {
|
---|
162 | return m_pUVM;
|
---|
163 | }
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * Gets the VMM function table.
|
---|
167 | * @returns The VMM function table.
|
---|
168 | */
|
---|
169 | PCVMMR3VTABLE getVMMFunctionTable() const
|
---|
170 | {
|
---|
171 | return m_pVMM;
|
---|
172 | }
|
---|
173 |
|
---|
174 | /**
|
---|
175 | * @returns The name of the machine.
|
---|
176 | */
|
---|
177 | QString getMachineName() const;
|
---|
178 |
|
---|
179 | protected slots:
|
---|
180 | /**
|
---|
181 | * Notify that a child object (i.e. a window is begin destroyed).
|
---|
182 | * @param pObj The object which is being destroyed.
|
---|
183 | */
|
---|
184 | void notifyChildDestroyed(QObject *pObj);
|
---|
185 |
|
---|
186 | protected:
|
---|
187 |
|
---|
188 | /** The debugger statistics. */
|
---|
189 | VBoxDbgStats *m_pDbgStats;
|
---|
190 | /** The debugger console (aka. command line). */
|
---|
191 | VBoxDbgConsole *m_pDbgConsole;
|
---|
192 |
|
---|
193 | /** The VirtualBox session. */
|
---|
194 | ISession *m_pSession;
|
---|
195 | /** The VirtualBox console. */
|
---|
196 | IConsole *m_pConsole;
|
---|
197 | /** The VirtualBox Machine Debugger. */
|
---|
198 | IMachineDebugger *m_pMachineDebugger;
|
---|
199 | /** The VirtualBox Machine. */
|
---|
200 | IMachine *m_pMachine;
|
---|
201 | /** The VM instance. */
|
---|
202 | PVM m_pVM;
|
---|
203 | /** The user mode VM handle. */
|
---|
204 | PUVM m_pUVM;
|
---|
205 | /** The VMM function table. */
|
---|
206 | PCVMMR3VTABLE m_pVMM;
|
---|
207 |
|
---|
208 | /** The parent widget. */
|
---|
209 | QWidget *m_pParent;
|
---|
210 | /** The menu object for the 'debug' menu. */
|
---|
211 | QMenu *m_pMenu;
|
---|
212 |
|
---|
213 | /** The x-coordinate of the window we're relative to. */
|
---|
214 | int m_x;
|
---|
215 | /** The y-coordinate of the window we're relative to. */
|
---|
216 | int m_y;
|
---|
217 | /** The width of the window we're relative to. */
|
---|
218 | unsigned m_cx;
|
---|
219 | /** The height of the window we're relative to. */
|
---|
220 | unsigned m_cy;
|
---|
221 | /** The x-coordinate of the desktop. */
|
---|
222 | int m_xDesktop;
|
---|
223 | /** The y-coordinate of the desktop. */
|
---|
224 | int m_yDesktop;
|
---|
225 | /** The size of the desktop. */
|
---|
226 | unsigned m_cxDesktop;
|
---|
227 | /** The size of the desktop. */
|
---|
228 | unsigned m_cyDesktop;
|
---|
229 | };
|
---|
230 |
|
---|
231 |
|
---|
232 | #endif /* !DEBUGGER_INCLUDED_SRC_VBoxDbgGui_h */
|
---|
233 |
|
---|