VirtualBox

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

Last change on this file since 3840 was 3723, checked in by vboxsync, 17 years ago

Double underscore cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.5 KB
Line 
1/* $Id: DBGFInternal.h 3723 2007-07-19 18:46:00Z vboxsync $ */
2/** @file
3 * DBGF - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
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
87} DBGFCMDDATA;
88/** Pointer to DBGF Command Data. */
89typedef DBGFCMDDATA *PDBGFCMDDATA;
90
91/**
92 * Info type.
93 */
94typedef enum DBGFINFOTYPE
95{
96 /** Invalid. */
97 DBGFINFOTYPE_INVALID = 0,
98 /** Device owner. */
99 DBGFINFOTYPE_DEV,
100 /** Driver owner. */
101 DBGFINFOTYPE_DRV,
102 /** Internal owner. */
103 DBGFINFOTYPE_INT,
104 /** External owner. */
105 DBGFINFOTYPE_EXT
106} DBGFINFOTYPE;
107
108
109/** Pointer to info structure. */
110typedef struct DBGFINFO *PDBGFINFO;
111
112/**
113 * Info structure.
114 */
115typedef struct DBGFINFO
116{
117 /** The flags. */
118 uint32_t fFlags;
119 /** Owner type. */
120 DBGFINFOTYPE enmType;
121 /** Per type data. */
122 union
123 {
124 /** DBGFINFOTYPE_DEV */
125 struct
126 {
127 /** Device info handler function. */
128 PFNDBGFHANDLERDEV pfnHandler;
129 /** The device instance. */
130 PPDMDEVINS pDevIns;
131 } Dev;
132
133 /** DBGFINFOTYPE_DRV */
134 struct
135 {
136 /** Driver info handler function. */
137 PFNDBGFHANDLERDRV pfnHandler;
138 /** The driver instance. */
139 PPDMDRVINS pDrvIns;
140 } Drv;
141
142 /** DBGFINFOTYPE_INT */
143 struct
144 {
145 /** Internal info handler function. */
146 PFNDBGFHANDLERINT pfnHandler;
147 } Int;
148
149 /** DBGFINFOTYPE_EXT */
150 struct
151 {
152 /** External info handler function. */
153 PFNDBGFHANDLEREXT pfnHandler;
154 /** The user argument. */
155 void *pvUser;
156 } Ext;
157 } u;
158
159 /** Pointer to the description. */
160 const char *pszDesc;
161 /** Pointer to the next info structure. */
162 PDBGFINFO pNext;
163 /** The identifier name length. */
164 size_t cchName;
165 /** The identifier name. (Extends 'beyond' the struct as usual.) */
166 char szName[1];
167} DBGFINFO;
168
169
170/**
171 * Converts a DBGF pointer into a VM pointer.
172 * @returns Pointer to the VM structure the CPUM is part of.
173 * @param pDBGF Pointer to DBGF instance data.
174 */
175#define DBGF2VM(pDBGF) ( (PVM)((char*)pDBGF - pDBGF->offVM) )
176
177
178/**
179 * DBGF Data (part of VM)
180 */
181typedef struct DBGF
182{
183 /** Offset to the VM structure. */
184 RTINT offVM;
185
186 /** Debugger Attached flag.
187 * Set if a debugger is attached, elsewise it's clear.
188 */
189 volatile bool fAttached;
190
191 /** Stopped in the Hypervisor.
192 * Set if we're stopped on a trace, breakpoint or assertion inside
193 * the hypervisor and have to restrict the available operations.
194 */
195 volatile bool fStoppedInHyper;
196
197 /**
198 * Ping-Pong construct where the Ping side is the VMM and the Pong side
199 * the Debugger.
200 */
201 RTPINGPONG PingPong;
202
203 /** The Event to the debugger.
204 * The VMM will ping the debugger when the event is ready. The event is
205 * either a response to a command or to a break/watch point issued
206 * previously.
207 */
208 DBGFEVENT DbgEvent;
209
210 /** The Command to the VMM.
211 * Operated in an atomic fashion since the VMM will poll on this.
212 * This means that a the command data must be written before this member
213 * is set. The VMM will reset this member to the no-command state
214 * when it have processed it.
215 */
216 volatile DBGFCMD enmVMMCmd;
217 /** The Command data.
218 * Not all commands take data. */
219 DBGFCMDDATA VMMCmdData;
220
221 /** List of registered info handlers. */
222 HCPTRTYPE(PDBGFINFO) pInfoFirst;
223 /** Critical section protecting the above list. */
224 RTCRITSECT InfoCritSect;
225
226 /** Range tree containing the loaded symbols of the a VM.
227 * This tree will never have blind spots. */
228 HCPTRTYPE(AVLRGCPTRTREE) SymbolTree;
229 /** Symbol name space. */
230 HCPTRTYPE(PRTSTRSPACE) pSymbolSpace;
231 /** Indicates whether DBGFSym.cpp is initialized or not.
232 * This part is initialized in a lazy manner for performance reasons. */
233 bool fSymInited;
234 /** Alignment padding. */
235 RTUINT uAlignment0;
236
237 /** The number of hardware breakpoints. */
238 RTUINT cHwBreakpoints;
239 /** The number of active breakpoints. */
240 RTUINT cBreakpoints;
241 /** Array of hardware breakpoints. (0..3) */
242 DBGFBP aHwBreakpoints[4];
243 /** Array of int 3 and REM breakpoints. (4..)
244 * @remark This is currently a fixed size array for reasons of simplicity. */
245 DBGFBP aBreakpoints[32];
246 /** Current active breakpoint (id).
247 * This is ~0U if not active. It is set when a execution engine
248 * encounters a breakpoint and returns VINF_EM_DBG_BREAKPOINT. This is
249 * currently not used for REM breakpoints because of the lazy coupling
250 * between VBox and REM. */
251 RTUINT iActiveBp;
252 /** Set if we're singlestepping in raw mode.
253 * This is checked and cleared in the \#DB handler. */
254 bool fSingleSteppingRaw;
255} DBGF;
256/** Pointer to DBGF Data. */
257typedef DBGF *PDBGF;
258
259
260extern int dbgfR3InfoInit(PVM pVM);
261extern int dbgfR3InfoTerm(PVM pVM);
262extern int dbgfR3SymInit(PVM pVM);
263extern int dbgfR3SymTerm(PVM pVM);
264extern int dbgfR3BpInit(PVM pVM);
265
266
267
268#ifdef IN_RING3
269
270#endif
271
272/** @} */
273
274#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