1 | /* $Id: DBGFInternal.h 73351 2018-07-25 13:02:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DBGF - Internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
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 |
|
---|
18 | #ifndef ___DBGFInternal_h
|
---|
19 | #define ___DBGFInternal_h
|
---|
20 |
|
---|
21 | #include <VBox/cdefs.h>
|
---|
22 | #ifdef IN_RING3
|
---|
23 | # include <VBox/dis.h>
|
---|
24 | #endif
|
---|
25 | #include <VBox/types.h>
|
---|
26 | #include <iprt/semaphore.h>
|
---|
27 | #include <iprt/critsect.h>
|
---|
28 | #include <iprt/string.h>
|
---|
29 | #include <iprt/avl.h>
|
---|
30 | #include <iprt/dbg.h>
|
---|
31 | #include <VBox/vmm/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. */
|
---|
43 | typedef 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 | /** Detaches the debugger.
|
---|
56 | * Disabling all breakpoints, watch points and the like. */
|
---|
57 | DBGFCMD_DETACH_DEBUGGER,
|
---|
58 | /** Detached the debugger.
|
---|
59 | * The isn't a command as such, it's just that it's necessary for the
|
---|
60 | * detaching protocol to be racefree. */
|
---|
61 | DBGFCMD_DETACHED_DEBUGGER
|
---|
62 | } DBGFCMD;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * VMM Debugger Command.
|
---|
66 | */
|
---|
67 | typedef union DBGFCMDDATA
|
---|
68 | {
|
---|
69 | uint32_t uDummy;
|
---|
70 | } DBGFCMDDATA;
|
---|
71 | /** Pointer to DBGF Command Data. */
|
---|
72 | typedef DBGFCMDDATA *PDBGFCMDDATA;
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Info type.
|
---|
76 | */
|
---|
77 | typedef enum DBGFINFOTYPE
|
---|
78 | {
|
---|
79 | /** Invalid. */
|
---|
80 | DBGFINFOTYPE_INVALID = 0,
|
---|
81 | /** Device owner. */
|
---|
82 | DBGFINFOTYPE_DEV,
|
---|
83 | /** Driver owner. */
|
---|
84 | DBGFINFOTYPE_DRV,
|
---|
85 | /** Internal owner. */
|
---|
86 | DBGFINFOTYPE_INT,
|
---|
87 | /** External owner. */
|
---|
88 | DBGFINFOTYPE_EXT
|
---|
89 | } DBGFINFOTYPE;
|
---|
90 |
|
---|
91 |
|
---|
92 | /** Pointer to info structure. */
|
---|
93 | typedef struct DBGFINFO *PDBGFINFO;
|
---|
94 |
|
---|
95 | #ifdef IN_RING3
|
---|
96 | /**
|
---|
97 | * Info structure.
|
---|
98 | */
|
---|
99 | typedef struct DBGFINFO
|
---|
100 | {
|
---|
101 | /** The flags. */
|
---|
102 | uint32_t fFlags;
|
---|
103 | /** Owner type. */
|
---|
104 | DBGFINFOTYPE enmType;
|
---|
105 | /** Per type data. */
|
---|
106 | union
|
---|
107 | {
|
---|
108 | /** DBGFINFOTYPE_DEV */
|
---|
109 | struct
|
---|
110 | {
|
---|
111 | /** Device info handler function. */
|
---|
112 | PFNDBGFHANDLERDEV pfnHandler;
|
---|
113 | /** The device instance. */
|
---|
114 | PPDMDEVINS pDevIns;
|
---|
115 | } Dev;
|
---|
116 |
|
---|
117 | /** DBGFINFOTYPE_DRV */
|
---|
118 | struct
|
---|
119 | {
|
---|
120 | /** Driver info handler function. */
|
---|
121 | PFNDBGFHANDLERDRV pfnHandler;
|
---|
122 | /** The driver instance. */
|
---|
123 | PPDMDRVINS pDrvIns;
|
---|
124 | } Drv;
|
---|
125 |
|
---|
126 | /** DBGFINFOTYPE_INT */
|
---|
127 | struct
|
---|
128 | {
|
---|
129 | /** Internal info handler function. */
|
---|
130 | PFNDBGFHANDLERINT pfnHandler;
|
---|
131 | } Int;
|
---|
132 |
|
---|
133 | /** DBGFINFOTYPE_EXT */
|
---|
134 | struct
|
---|
135 | {
|
---|
136 | /** External info handler function. */
|
---|
137 | PFNDBGFHANDLEREXT pfnHandler;
|
---|
138 | /** The user argument. */
|
---|
139 | void *pvUser;
|
---|
140 | } Ext;
|
---|
141 | } u;
|
---|
142 |
|
---|
143 | /** Pointer to the description. */
|
---|
144 | const char *pszDesc;
|
---|
145 | /** Pointer to the next info structure. */
|
---|
146 | PDBGFINFO pNext;
|
---|
147 | /** The identifier name length. */
|
---|
148 | size_t cchName;
|
---|
149 | /** The identifier name. (Extends 'beyond' the struct as usual.) */
|
---|
150 | char szName[1];
|
---|
151 | } DBGFINFO;
|
---|
152 | #endif /* IN_RING3 */
|
---|
153 |
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * Guest OS digger instance.
|
---|
157 | */
|
---|
158 | typedef struct DBGFOS
|
---|
159 | {
|
---|
160 | /** Pointer to the registration record. */
|
---|
161 | PCDBGFOSREG pReg;
|
---|
162 | /** Pointer to the next OS we've registered. */
|
---|
163 | struct DBGFOS *pNext;
|
---|
164 | /** List of EMT interface wrappers. */
|
---|
165 | struct DBGFOSEMTWRAPPER *pWrapperHead;
|
---|
166 | /** The instance data (variable size). */
|
---|
167 | uint8_t abData[16];
|
---|
168 | } DBGFOS;
|
---|
169 | /** Pointer to guest OS digger instance. */
|
---|
170 | typedef DBGFOS *PDBGFOS;
|
---|
171 | /** Pointer to const guest OS digger instance. */
|
---|
172 | typedef DBGFOS const *PCDBGFOS;
|
---|
173 |
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * Breakpoint search optimization.
|
---|
177 | */
|
---|
178 | typedef struct DBGFBPSEARCHOPT
|
---|
179 | {
|
---|
180 | /** Where to start searching for hits.
|
---|
181 | * (First enabled is #DBGF::aBreakpoints[iStartSearch]). */
|
---|
182 | uint32_t volatile iStartSearch;
|
---|
183 | /** The number of aBreakpoints entries to search.
|
---|
184 | * (Last enabled is #DBGF::aBreakpoints[iStartSearch + cToSearch - 1]) */
|
---|
185 | uint32_t volatile cToSearch;
|
---|
186 | } DBGFBPSEARCHOPT;
|
---|
187 | /** Pointer to a breakpoint search optimziation structure. */
|
---|
188 | typedef DBGFBPSEARCHOPT *PDBGFBPSEARCHOPT;
|
---|
189 |
|
---|
190 |
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * DBGF Data (part of VM)
|
---|
194 | */
|
---|
195 | typedef struct DBGF
|
---|
196 | {
|
---|
197 | /** Bitmap of enabled hardware interrupt breakpoints. */
|
---|
198 | uint32_t bmHardIntBreakpoints[256 / 32];
|
---|
199 | /** Bitmap of enabled software interrupt breakpoints. */
|
---|
200 | uint32_t bmSoftIntBreakpoints[256 / 32];
|
---|
201 | /** Bitmap of selected events.
|
---|
202 | * This includes non-selectable events too for simplicity, we maintain the
|
---|
203 | * state for some of these, as it may come in handy. */
|
---|
204 | uint64_t bmSelectedEvents[(DBGFEVENT_END + 63) / 64];
|
---|
205 |
|
---|
206 | /** Enabled hardware interrupt breakpoints. */
|
---|
207 | uint32_t cHardIntBreakpoints;
|
---|
208 | /** Enabled software interrupt breakpoints. */
|
---|
209 | uint32_t cSoftIntBreakpoints;
|
---|
210 |
|
---|
211 | /** The number of selected events. */
|
---|
212 | uint32_t cSelectedEvents;
|
---|
213 |
|
---|
214 | /** The number of enabled hardware breakpoints. */
|
---|
215 | uint8_t cEnabledHwBreakpoints;
|
---|
216 | /** The number of enabled hardware I/O breakpoints. */
|
---|
217 | uint8_t cEnabledHwIoBreakpoints;
|
---|
218 | /** The number of enabled INT3 breakpoints. */
|
---|
219 | uint8_t cEnabledInt3Breakpoints;
|
---|
220 | uint8_t abPadding; /**< Unused padding space up for grabs. */
|
---|
221 | uint32_t uPadding;
|
---|
222 |
|
---|
223 | /** Debugger Attached flag.
|
---|
224 | * Set if a debugger is attached, elsewise it's clear.
|
---|
225 | */
|
---|
226 | bool volatile fAttached;
|
---|
227 |
|
---|
228 | /** Stopped in the Hypervisor.
|
---|
229 | * Set if we're stopped on a trace, breakpoint or assertion inside
|
---|
230 | * the hypervisor and have to restrict the available operations.
|
---|
231 | */
|
---|
232 | bool volatile fStoppedInHyper;
|
---|
233 |
|
---|
234 | /**
|
---|
235 | * Ping-Pong construct where the Ping side is the VMM and the Pong side
|
---|
236 | * the Debugger.
|
---|
237 | */
|
---|
238 | RTPINGPONG PingPong;
|
---|
239 | RTHCUINTPTR uPtrPadding; /**< Alignment padding. */
|
---|
240 |
|
---|
241 | /** The Event to the debugger.
|
---|
242 | * The VMM will ping the debugger when the event is ready. The event is
|
---|
243 | * either a response to a command or to a break/watch point issued
|
---|
244 | * previously.
|
---|
245 | */
|
---|
246 | DBGFEVENT DbgEvent;
|
---|
247 |
|
---|
248 | /** The Command to the VMM.
|
---|
249 | * Operated in an atomic fashion since the VMM will poll on this.
|
---|
250 | * This means that a the command data must be written before this member
|
---|
251 | * is set. The VMM will reset this member to the no-command state
|
---|
252 | * when it have processed it.
|
---|
253 | */
|
---|
254 | DBGFCMD volatile enmVMMCmd;
|
---|
255 | /** The Command data.
|
---|
256 | * Not all commands take data. */
|
---|
257 | DBGFCMDDATA VMMCmdData;
|
---|
258 |
|
---|
259 | /** Stepping filtering. */
|
---|
260 | struct
|
---|
261 | {
|
---|
262 | /** The CPU doing the stepping.
|
---|
263 | * Set to NIL_VMCPUID when filtering is inactive */
|
---|
264 | VMCPUID idCpu;
|
---|
265 | /** The specified flags. */
|
---|
266 | uint32_t fFlags;
|
---|
267 | /** The effective PC address to stop at, if given. */
|
---|
268 | RTGCPTR AddrPc;
|
---|
269 | /** The lowest effective stack address to stop at.
|
---|
270 | * Together with cbStackPop, this forms a range of effective stack pointer
|
---|
271 | * addresses that we stop for. */
|
---|
272 | RTGCPTR AddrStackPop;
|
---|
273 | /** The size of the stack stop area starting at AddrStackPop. */
|
---|
274 | RTGCPTR cbStackPop;
|
---|
275 | /** Maximum number of steps. */
|
---|
276 | uint32_t cMaxSteps;
|
---|
277 |
|
---|
278 | /** Number of steps made thus far. */
|
---|
279 | uint32_t cSteps;
|
---|
280 | /** Current call counting balance for step-over handling. */
|
---|
281 | uint32_t uCallDepth;
|
---|
282 |
|
---|
283 | uint32_t u32Padding; /**< Alignment padding. */
|
---|
284 |
|
---|
285 | } SteppingFilter;
|
---|
286 |
|
---|
287 | uint32_t u32Padding[2]; /**< Alignment padding. */
|
---|
288 |
|
---|
289 | /** Array of hardware breakpoints. (0..3)
|
---|
290 | * This is shared among all the CPUs because life is much simpler that way. */
|
---|
291 | DBGFBP aHwBreakpoints[4];
|
---|
292 | /** Array of int 3 and REM breakpoints. (4..)
|
---|
293 | * @remark This is currently a fixed size array for reasons of simplicity. */
|
---|
294 | DBGFBP aBreakpoints[32];
|
---|
295 |
|
---|
296 | /** MMIO breakpoint search optimizations. */
|
---|
297 | DBGFBPSEARCHOPT Mmio;
|
---|
298 | /** I/O port breakpoint search optimizations. */
|
---|
299 | DBGFBPSEARCHOPT PortIo;
|
---|
300 | /** INT3 breakpoint search optimizations. */
|
---|
301 | DBGFBPSEARCHOPT Int3;
|
---|
302 |
|
---|
303 | /**
|
---|
304 | * Bug check data.
|
---|
305 | * @note This will not be reset on reset.
|
---|
306 | */
|
---|
307 | struct
|
---|
308 | {
|
---|
309 | /** The ID of the CPU reporting it. */
|
---|
310 | VMCPUID idCpu;
|
---|
311 | /** The event associated with the bug check (gives source).
|
---|
312 | * This is set to DBGFEVENT_END if no BSOD data here. */
|
---|
313 | DBGFEVENTTYPE enmEvent;
|
---|
314 | /** The total reset count at the time (VMGetResetCount). */
|
---|
315 | uint32_t uResetNo;
|
---|
316 | /** Explicit padding. */
|
---|
317 | uint32_t uPadding;
|
---|
318 | /** When it was reported (TMVirtualGet). */
|
---|
319 | uint64_t uTimestamp;
|
---|
320 | /** The bug check number.
|
---|
321 | * @note This is really just 32-bit wide, see KeBugCheckEx. */
|
---|
322 | uint64_t uBugCheck;
|
---|
323 | /** The bug check parameters. */
|
---|
324 | uint64_t auParameters[4];
|
---|
325 | } BugCheck;
|
---|
326 | } DBGF;
|
---|
327 | AssertCompileMemberAlignment(DBGF, DbgEvent, 8);
|
---|
328 | AssertCompileMemberAlignment(DBGF, aHwBreakpoints, 8);
|
---|
329 | AssertCompileMemberAlignment(DBGF, bmHardIntBreakpoints, 8);
|
---|
330 | /** Pointer to DBGF Data. */
|
---|
331 | typedef DBGF *PDBGF;
|
---|
332 |
|
---|
333 |
|
---|
334 | /**
|
---|
335 | * Event state (for DBGFCPU::aEvents).
|
---|
336 | */
|
---|
337 | typedef enum DBGFEVENTSTATE
|
---|
338 | {
|
---|
339 | /** Invalid event stack entry. */
|
---|
340 | DBGFEVENTSTATE_INVALID = 0,
|
---|
341 | /** The current event stack entry. */
|
---|
342 | DBGFEVENTSTATE_CURRENT,
|
---|
343 | /** Event that should be ignored but hasn't yet actually been ignored. */
|
---|
344 | DBGFEVENTSTATE_IGNORE,
|
---|
345 | /** Event that has been ignored but may be restored to IGNORE should another
|
---|
346 | * debug event fire before the instruction is completed. */
|
---|
347 | DBGFEVENTSTATE_RESTORABLE,
|
---|
348 | /** End of valid events. */
|
---|
349 | DBGFEVENTSTATE_END,
|
---|
350 | /** Make sure we've got a 32-bit type. */
|
---|
351 | DBGFEVENTSTATE_32BIT_HACK = 0x7fffffff
|
---|
352 | } DBGFEVENTSTATE;
|
---|
353 |
|
---|
354 |
|
---|
355 | /** Converts a DBGFCPU pointer into a VM pointer. */
|
---|
356 | #define DBGFCPU_2_VM(pDbgfCpu) ((PVM)((uint8_t *)(pDbgfCpu) + (pDbgfCpu)->offVM))
|
---|
357 |
|
---|
358 | /**
|
---|
359 | * The per CPU data for DBGF.
|
---|
360 | */
|
---|
361 | typedef struct DBGFCPU
|
---|
362 | {
|
---|
363 | /** The offset into the VM structure.
|
---|
364 | * @see DBGFCPU_2_VM(). */
|
---|
365 | uint32_t offVM;
|
---|
366 |
|
---|
367 | /** Current active breakpoint (id).
|
---|
368 | * This is ~0U if not active. It is set when a execution engine
|
---|
369 | * encounters a breakpoint and returns VINF_EM_DBG_BREAKPOINT. This is
|
---|
370 | * currently not used for REM breakpoints because of the lazy coupling
|
---|
371 | * between VBox and REM.
|
---|
372 | *
|
---|
373 | * @todo drop this in favor of aEvents! */
|
---|
374 | uint32_t iActiveBp;
|
---|
375 | /** Set if we're singlestepping in raw mode.
|
---|
376 | * This is checked and cleared in the \#DB handler. */
|
---|
377 | bool fSingleSteppingRaw;
|
---|
378 |
|
---|
379 | /** Alignment padding. */
|
---|
380 | bool afPadding[3];
|
---|
381 |
|
---|
382 | /** The number of events on the stack (aEvents).
|
---|
383 | * The pending event is the last one (aEvents[cEvents - 1]), but only when
|
---|
384 | * enmState is DBGFEVENTSTATE_CURRENT. */
|
---|
385 | uint32_t cEvents;
|
---|
386 | /** Events - current, ignoring and ignored.
|
---|
387 | *
|
---|
388 | * We maintain a stack of events in order to try avoid ending up in an infinit
|
---|
389 | * loop when resuming after an event fired. There are cases where we may end
|
---|
390 | * generating additional events before the instruction can be executed
|
---|
391 | * successfully. Like for instance an XCHG on MMIO with separate read and write
|
---|
392 | * breakpoints, or a MOVSB instruction working on breakpointed MMIO as both
|
---|
393 | * source and destination.
|
---|
394 | *
|
---|
395 | * So, when resuming after dropping into the debugger for an event, we convert
|
---|
396 | * the DBGFEVENTSTATE_CURRENT event into a DBGFEVENTSTATE_IGNORE event, leaving
|
---|
397 | * cEvents unchanged. If the event is reported again, we will ignore it and
|
---|
398 | * tell the reporter to continue executing. The event change to the
|
---|
399 | * DBGFEVENTSTATE_RESTORABLE state.
|
---|
400 | *
|
---|
401 | * Currently, the event reporter has to figure out that it is a nested event and
|
---|
402 | * tell DBGF to restore DBGFEVENTSTATE_RESTORABLE events (and keep
|
---|
403 | * DBGFEVENTSTATE_IGNORE, should they happen out of order for some weird
|
---|
404 | * reason).
|
---|
405 | */
|
---|
406 | struct
|
---|
407 | {
|
---|
408 | /** The event details. */
|
---|
409 | DBGFEVENT Event;
|
---|
410 | /** The RIP at which this happend (for validating ignoring). */
|
---|
411 | uint64_t rip;
|
---|
412 | /** The event state. */
|
---|
413 | DBGFEVENTSTATE enmState;
|
---|
414 | /** Alignment padding. */
|
---|
415 | uint32_t u32Alignment;
|
---|
416 | } aEvents[3];
|
---|
417 | } DBGFCPU;
|
---|
418 | AssertCompileMemberAlignment(DBGFCPU, aEvents, 8);
|
---|
419 | AssertCompileMemberSizeAlignment(DBGFCPU, aEvents[0], 8);
|
---|
420 | /** Pointer to DBGFCPU data. */
|
---|
421 | typedef DBGFCPU *PDBGFCPU;
|
---|
422 |
|
---|
423 | struct DBGFOSEMTWRAPPER;
|
---|
424 |
|
---|
425 | /**
|
---|
426 | * The DBGF data kept in the UVM.
|
---|
427 | */
|
---|
428 | typedef struct DBGFUSERPERVM
|
---|
429 | {
|
---|
430 | /** The address space database lock. */
|
---|
431 | RTSEMRW hAsDbLock;
|
---|
432 | /** The address space handle database. (Protected by hAsDbLock.) */
|
---|
433 | R3PTRTYPE(AVLPVTREE) AsHandleTree;
|
---|
434 | /** The address space process id database. (Protected by hAsDbLock.) */
|
---|
435 | R3PTRTYPE(AVLU32TREE) AsPidTree;
|
---|
436 | /** The address space name database. (Protected by hAsDbLock.) */
|
---|
437 | R3PTRTYPE(RTSTRSPACE) AsNameSpace;
|
---|
438 | /** Special address space aliases. (Protected by hAsDbLock.) */
|
---|
439 | RTDBGAS volatile ahAsAliases[DBGF_AS_COUNT];
|
---|
440 | /** For lazily populating the aliased address spaces. */
|
---|
441 | bool volatile afAsAliasPopuplated[DBGF_AS_COUNT];
|
---|
442 | /** Alignment padding. */
|
---|
443 | bool afAlignment1[2];
|
---|
444 | /** Debug configuration. */
|
---|
445 | R3PTRTYPE(RTDBGCFG) hDbgCfg;
|
---|
446 |
|
---|
447 | /** The register database lock. */
|
---|
448 | RTSEMRW hRegDbLock;
|
---|
449 | /** String space for looking up registers. (Protected by hRegDbLock.) */
|
---|
450 | R3PTRTYPE(RTSTRSPACE) RegSpace;
|
---|
451 | /** String space holding the register sets. (Protected by hRegDbLock.) */
|
---|
452 | R3PTRTYPE(RTSTRSPACE) RegSetSpace;
|
---|
453 | /** The number of registers (aliases, sub-fields and the special CPU
|
---|
454 | * register aliases (eg AH) are not counted). */
|
---|
455 | uint32_t cRegs;
|
---|
456 | /** For early initialization by . */
|
---|
457 | bool volatile fRegDbInitialized;
|
---|
458 | /** Alignment padding. */
|
---|
459 | bool afAlignment2[3];
|
---|
460 |
|
---|
461 | /** Critical section protecting the Guest OS Digger data, the info handlers
|
---|
462 | * and the plugins. These share to give the best possible plugin unload
|
---|
463 | * race protection. */
|
---|
464 | RTCRITSECTRW CritSect;
|
---|
465 | /** Head of the LIFO of loaded DBGF plugins. */
|
---|
466 | R3PTRTYPE(struct DBGFPLUGIN *) pPlugInHead;
|
---|
467 | /** The current Guest OS digger. */
|
---|
468 | R3PTRTYPE(PDBGFOS) pCurOS;
|
---|
469 | /** The head of the Guest OS digger instances. */
|
---|
470 | R3PTRTYPE(PDBGFOS) pOSHead;
|
---|
471 | /** List of registered info handlers. */
|
---|
472 | R3PTRTYPE(PDBGFINFO) pInfoFirst;
|
---|
473 |
|
---|
474 | /** The type database lock. */
|
---|
475 | RTSEMRW hTypeDbLock;
|
---|
476 | /** String space for looking up types. (Protected by hTypeDbLock.) */
|
---|
477 | R3PTRTYPE(RTSTRSPACE) TypeSpace;
|
---|
478 | /** For early initialization by . */
|
---|
479 | bool volatile fTypeDbInitialized;
|
---|
480 | /** Alignment padding. */
|
---|
481 | bool afAlignment3[3];
|
---|
482 |
|
---|
483 | } DBGFUSERPERVM;
|
---|
484 | typedef DBGFUSERPERVM *PDBGFUSERPERVM;
|
---|
485 | typedef DBGFUSERPERVM const *PCDBGFUSERPERVM;
|
---|
486 |
|
---|
487 | /**
|
---|
488 | * The per-CPU DBGF data kept in the UVM.
|
---|
489 | */
|
---|
490 | typedef struct DBGFUSERPERVMCPU
|
---|
491 | {
|
---|
492 | /** The guest register set for this CPU. Can be NULL. */
|
---|
493 | R3PTRTYPE(struct DBGFREGSET *) pGuestRegSet;
|
---|
494 | /** The hypervisor register set for this CPU. Can be NULL. */
|
---|
495 | R3PTRTYPE(struct DBGFREGSET *) pHyperRegSet;
|
---|
496 | } DBGFUSERPERVMCPU;
|
---|
497 |
|
---|
498 |
|
---|
499 | int dbgfR3AsInit(PUVM pUVM);
|
---|
500 | void dbgfR3AsTerm(PUVM pUVM);
|
---|
501 | void dbgfR3AsRelocate(PUVM pUVM, RTGCUINTPTR offDelta);
|
---|
502 | int dbgfR3BpInit(PVM pVM);
|
---|
503 | int dbgfR3InfoInit(PUVM pUVM);
|
---|
504 | int dbgfR3InfoTerm(PUVM pUVM);
|
---|
505 | int dbgfR3OSInit(PUVM pUVM);
|
---|
506 | void dbgfR3OSTerm(PUVM pUVM);
|
---|
507 | int dbgfR3RegInit(PUVM pUVM);
|
---|
508 | void dbgfR3RegTerm(PUVM pUVM);
|
---|
509 | int dbgfR3TraceInit(PVM pVM);
|
---|
510 | void dbgfR3TraceRelocate(PVM pVM);
|
---|
511 | void dbgfR3TraceTerm(PVM pVM);
|
---|
512 | DECLHIDDEN(int) dbgfR3TypeInit(PUVM pUVM);
|
---|
513 | DECLHIDDEN(void) dbgfR3TypeTerm(PUVM pUVM);
|
---|
514 | int dbgfR3PlugInInit(PUVM pUVM);
|
---|
515 | void dbgfR3PlugInTerm(PUVM pUVM);
|
---|
516 | int dbgfR3BugCheckInit(PVM pVM);
|
---|
517 |
|
---|
518 |
|
---|
519 |
|
---|
520 | #ifdef IN_RING3
|
---|
521 | /**
|
---|
522 | * DBGF disassembler state (substate of DISSTATE).
|
---|
523 | */
|
---|
524 | typedef struct DBGFDISSTATE
|
---|
525 | {
|
---|
526 | /** Pointer to the current instruction. */
|
---|
527 | PCDISOPCODE pCurInstr;
|
---|
528 | /** Size of the instruction in bytes. */
|
---|
529 | uint32_t cbInstr;
|
---|
530 | /** Parameters. */
|
---|
531 | DISOPPARAM Param1;
|
---|
532 | DISOPPARAM Param2;
|
---|
533 | DISOPPARAM Param3;
|
---|
534 | DISOPPARAM Param4;
|
---|
535 | } DBGFDISSTATE;
|
---|
536 | /** Pointer to a DBGF disassembler state. */
|
---|
537 | typedef DBGFDISSTATE *PDBGFDISSTATE;
|
---|
538 |
|
---|
539 | DECLHIDDEN(int) dbgfR3DisasInstrStateEx(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddr, uint32_t fFlags,
|
---|
540 | char *pszOutput, uint32_t cbOutput, PDBGFDISSTATE pDisState);
|
---|
541 |
|
---|
542 | #endif
|
---|
543 |
|
---|
544 | /** @} */
|
---|
545 |
|
---|
546 | #endif
|
---|