VirtualBox

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

Last change on this file since 5605 was 4787, checked in by vboxsync, 17 years ago

Eliminated HCPTRTYPE and replaced with R3R0PTRTYPE where necessary.

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