VirtualBox

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

Last change on this file since 12866 was 12663, checked in by vboxsync, 16 years ago

#1865: DBGF, nothing really relevant here just some cleaning up.

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