VirtualBox

source: vbox/trunk/src/VBox/VMM/DBGFInternal.h@ 13762

Last change on this file since 13762 was 12989, checked in by vboxsync, 16 years ago

VMM + VBox/cdefs.h: consolidated all the XYZ*DECLS of the VMM into VMM*DECL. Removed dead DECL and IN_XYZ* macros.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.1 KB
Line 
1/* $Id: DBGFInternal.h 12989 2008-10-06 02:15:39Z vboxsync $ */
2/** @file
3 * DBGF - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ___DBGFInternal_h
23#define ___DBGFInternal_h
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <iprt/semaphore.h>
28#include <iprt/critsect.h>
29#include <iprt/string.h>
30#include <iprt/avl.h>
31#include <VBox/dbgf.h>
32
33
34
35/** @defgroup grp_dbgf_int Internals
36 * @ingroup grp_dbgf
37 * @internal
38 * @{
39 */
40
41
42/** VMM Debugger Command. */
43typedef enum DBGFCMD
44{
45 /** No command.
46 * This is assigned to the field by the emulation thread after
47 * a command has been completed. */
48 DBGFCMD_NO_COMMAND = 0,
49 /** Halt the VM. */
50 DBGFCMD_HALT,
51 /** Resume execution. */
52 DBGFCMD_GO,
53 /** Single step execution - stepping into calls. */
54 DBGFCMD_SINGLE_STEP,
55 /** Set a breakpoint. */
56 DBGFCMD_BREAKPOINT_SET,
57 /** Set a access breakpoint. */
58 DBGFCMD_BREAKPOINT_SET_ACCESS,
59 /** Set a REM breakpoint. */
60 DBGFCMD_BREAKPOINT_SET_REM,
61 /** Clear a breakpoint. */
62 DBGFCMD_BREAKPOINT_CLEAR,
63 /** Enable a breakpoint. */
64 DBGFCMD_BREAKPOINT_ENABLE,
65 /** Disable a breakpoint. */
66 DBGFCMD_BREAKPOINT_DISABLE,
67 /** List breakpoints. */
68 DBGFCMD_BREAKPOINT_LIST,
69
70 /** Detaches the debugger.
71 * Disabling all breakpoints, watch points and the like. */
72 DBGFCMD_DETACH_DEBUGGER = 0x7ffffffe,
73 /** Detached the debugger.
74 * The isn't a command as such, it's just that it's necessary for the
75 * detaching protocol to be racefree. */
76 DBGFCMD_DETACHED_DEBUGGER = 0x7fffffff
77} DBGFCMD;
78
79/**
80 * VMM Debugger Command.
81 */
82typedef union DBGFCMDDATA
83{
84 uint32_t uDummy;
85} DBGFCMDDATA;
86/** Pointer to DBGF Command Data. */
87typedef DBGFCMDDATA *PDBGFCMDDATA;
88
89/**
90 * Info type.
91 */
92typedef enum DBGFINFOTYPE
93{
94 /** Invalid. */
95 DBGFINFOTYPE_INVALID = 0,
96 /** Device owner. */
97 DBGFINFOTYPE_DEV,
98 /** Driver owner. */
99 DBGFINFOTYPE_DRV,
100 /** Internal owner. */
101 DBGFINFOTYPE_INT,
102 /** External owner. */
103 DBGFINFOTYPE_EXT
104} DBGFINFOTYPE;
105
106
107/** Pointer to info structure. */
108typedef struct DBGFINFO *PDBGFINFO;
109
110/**
111 * Info structure.
112 */
113typedef struct DBGFINFO
114{
115 /** The flags. */
116 uint32_t fFlags;
117 /** Owner type. */
118 DBGFINFOTYPE enmType;
119 /** Per type data. */
120 union
121 {
122 /** DBGFINFOTYPE_DEV */
123 struct
124 {
125 /** Device info handler function. */
126 PFNDBGFHANDLERDEV pfnHandler;
127 /** The device instance. */
128 PPDMDEVINS pDevIns;
129 } Dev;
130
131 /** DBGFINFOTYPE_DRV */
132 struct
133 {
134 /** Driver info handler function. */
135 PFNDBGFHANDLERDRV pfnHandler;
136 /** The driver instance. */
137 PPDMDRVINS pDrvIns;
138 } Drv;
139
140 /** DBGFINFOTYPE_INT */
141 struct
142 {
143 /** Internal info handler function. */
144 PFNDBGFHANDLERINT pfnHandler;
145 } Int;
146
147 /** DBGFINFOTYPE_EXT */
148 struct
149 {
150 /** External info handler function. */
151 PFNDBGFHANDLEREXT pfnHandler;
152 /** The user argument. */
153 void *pvUser;
154 } Ext;
155 } u;
156
157 /** Pointer to the description. */
158 const char *pszDesc;
159 /** Pointer to the next info structure. */
160 PDBGFINFO pNext;
161 /** The identifier name length. */
162 size_t cchName;
163 /** The identifier name. (Extends 'beyond' the struct as usual.) */
164 char szName[1];
165} DBGFINFO;
166
167
168/**
169 * Guest OS digger instance.
170 */
171typedef struct DBGFOS
172{
173 /** Pointer to the registration record. */
174 PCDBGFOSREG pReg;
175 /** Pointer to the next OS we've registered. */
176 struct DBGFOS *pNext;
177 /** The instance data (variable size). */
178 uint8_t abData[16];
179} DBGFOS;
180/** Pointer to guest OS digger instance. */
181typedef DBGFOS *PDBGFOS;
182/** Pointer to const guest OS digger instance. */
183typedef DBGFOS const *PCDBGFOS;
184
185
186/**
187 * Converts a DBGF pointer into a VM pointer.
188 * @returns Pointer to the VM structure the CPUM is part of.
189 * @param pDBGF Pointer to DBGF instance data.
190 */
191#define DBGF2VM(pDBGF) ( (PVM)((char*)pDBGF - pDBGF->offVM) )
192
193
194/**
195 * DBGF Data (part of VM)
196 */
197typedef struct DBGF
198{
199 /** Offset to the VM structure. */
200 RTINT offVM;
201
202 /** Debugger Attached flag.
203 * Set if a debugger is attached, elsewise it's clear.
204 */
205 bool volatile fAttached;
206
207 /** Stopped in the Hypervisor.
208 * Set if we're stopped on a trace, breakpoint or assertion inside
209 * the hypervisor and have to restrict the available operations.
210 */
211 bool volatile fStoppedInHyper;
212
213 /**
214 * Ping-Pong construct where the Ping side is the VMM and the Pong side
215 * the Debugger.
216 */
217 RTPINGPONG PingPong;
218
219 /** The Event to the debugger.
220 * The VMM will ping the debugger when the event is ready. The event is
221 * either a response to a command or to a break/watch point issued
222 * previously.
223 */
224 DBGFEVENT DbgEvent;
225
226 /** The Command to the VMM.
227 * Operated in an atomic fashion since the VMM will poll on this.
228 * This means that a the command data must be written before this member
229 * is set. The VMM will reset this member to the no-command state
230 * when it have processed it.
231 */
232 DBGFCMD volatile enmVMMCmd;
233 /** The Command data.
234 * Not all commands take data. */
235 DBGFCMDDATA VMMCmdData;
236
237 /** List of registered info handlers. */
238 R3PTRTYPE(PDBGFINFO) pInfoFirst;
239 /** Critical section protecting the above list. */
240 RTCRITSECT InfoCritSect;
241
242 /** Range tree containing the loaded symbols of the a VM.
243 * This tree will never have blind spots. */
244 R3PTRTYPE(AVLRGCPTRTREE) SymbolTree;
245 /** Symbol name space. */
246 R3PTRTYPE(PRTSTRSPACE) pSymbolSpace;
247 /** Indicates whether DBGFSym.cpp is initialized or not.
248 * This part is initialized in a lazy manner for performance reasons. */
249 bool fSymInited;
250 /** Alignment padding. */
251 RTUINT uAlignment0;
252
253 /** The number of hardware breakpoints. */
254 RTUINT cHwBreakpoints;
255 /** The number of active breakpoints. */
256 RTUINT cBreakpoints;
257 /** Array of hardware breakpoints. (0..3) */
258 DBGFBP aHwBreakpoints[4];
259 /** Array of int 3 and REM breakpoints. (4..)
260 * @remark This is currently a fixed size array for reasons of simplicity. */
261 DBGFBP aBreakpoints[32];
262 /** Current active breakpoint (id).
263 * This is ~0U if not active. It is set when a execution engine
264 * encounters a breakpoint and returns VINF_EM_DBG_BREAKPOINT. This is
265 * currently not used for REM breakpoints because of the lazy coupling
266 * between VBox and REM. */
267 RTUINT iActiveBp;
268 /** Set if we're singlestepping in raw mode.
269 * This is checked and cleared in the \#DB handler. */
270 bool fSingleSteppingRaw;
271
272 /** The current Guest OS digger. */
273 R3PTRTYPE(PDBGFOS) pCurOS;
274 /** The head of the Guest OS digger instances. */
275 R3PTRTYPE(PDBGFOS) pOSHead;
276} DBGF;
277/** Pointer to DBGF Data. */
278typedef DBGF *PDBGF;
279
280
281extern int dbgfR3InfoInit(PVM pVM);
282extern int dbgfR3InfoTerm(PVM pVM);
283extern void dbgfR3OSTerm(PVM pVM);
284extern int dbgfR3SymInit(PVM pVM);
285extern int dbgfR3SymTerm(PVM pVM);
286extern int dbgfR3BpInit(PVM pVM);
287
288
289
290#ifdef IN_RING3
291
292#endif
293
294/** @} */
295
296#endif
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use