VirtualBox

source: vbox/trunk/include/VBox/dbgf.h@ 25346

Last change on this file since 25346 was 24061, checked in by vboxsync, 15 years ago

DBGF,DBGPlugInDiggers: Extended DBGFR3MemScan with an alignment restriction. Added DBGFR3CpuGetMode. Started on the WinNT debug digger - can detect the 32-bit kernel, locate the module list and report the nt version.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 38.6 KB
Line 
1/** @file
2 * DBGF - Debugger Facility. (VMM)
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_dbgf_h
31#define ___VBox_dbgf_h
32
33#include <VBox/cdefs.h>
34#include <VBox/types.h>
35#include <VBox/vmm.h>
36#include <VBox/log.h> /* LOG_ENABLED */
37#include <VBox/dbgfsel.h>
38
39#include <iprt/stdarg.h>
40#include <iprt/dbg.h>
41
42RT_C_DECLS_BEGIN
43
44
45/** @defgroup grp_dbgf The Debugger Facility API
46 * @{
47 */
48
49#if defined(IN_RC)|| defined(IN_RING0)
50/** @addgroup grp_dbgf_rz The RZ DBGF API
51 * @ingroup grp_dbgf
52 * @{
53 */
54VMMRZDECL(int) DBGFRZTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6);
55VMMRZDECL(int) DBGFRZTrap03Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
56/** @} */
57#endif
58
59
60
61/**
62 * Mixed address.
63 */
64typedef struct DBGFADDRESS
65{
66 /** The flat address. */
67 RTGCUINTPTR FlatPtr;
68 /** The selector offset address. */
69 RTGCUINTPTR off;
70 /** The selector. DBGF_SEL_FLAT is a legal value. */
71 RTSEL Sel;
72 /** Flags describing further details about the address. */
73 uint16_t fFlags;
74} DBGFADDRESS;
75/** Pointer to a mixed address. */
76typedef DBGFADDRESS *PDBGFADDRESS;
77/** Pointer to a const mixed address. */
78typedef const DBGFADDRESS *PCDBGFADDRESS;
79
80/** @name DBGFADDRESS Flags.
81 * @{ */
82/** A 16:16 far address. */
83#define DBGFADDRESS_FLAGS_FAR16 0
84/** A 16:32 far address. */
85#define DBGFADDRESS_FLAGS_FAR32 1
86/** A 16:64 far address. */
87#define DBGFADDRESS_FLAGS_FAR64 2
88/** A flat address. */
89#define DBGFADDRESS_FLAGS_FLAT 3
90/** A physical address. */
91#define DBGFADDRESS_FLAGS_PHYS 4
92/** A physical address. */
93#define DBGFADDRESS_FLAGS_RING0 5
94/** The address type mask. */
95#define DBGFADDRESS_FLAGS_TYPE_MASK 7
96
97/** Set if the address is valid. */
98#define DBGFADDRESS_FLAGS_VALID RT_BIT(3)
99
100/** The address is within the hypervisor memoary area (HMA).
101 * If not set, the address can be assumed to be a guest address. */
102#define DBGFADDRESS_FLAGS_HMA RT_BIT(4)
103
104/** Checks if the mixed address is flat or not. */
105#define DBGFADDRESS_IS_FLAT(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FLAT )
106/** Checks if the mixed address is flat or not. */
107#define DBGFADDRESS_IS_PHYS(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_PHYS )
108/** Checks if the mixed address is far 16:16 or not. */
109#define DBGFADDRESS_IS_FAR16(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR16 )
110/** Checks if the mixed address is far 16:32 or not. */
111#define DBGFADDRESS_IS_FAR32(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR32 )
112/** Checks if the mixed address is far 16:64 or not. */
113#define DBGFADDRESS_IS_FAR64(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR64 )
114/** Checks if the mixed address is valid. */
115#define DBGFADDRESS_IS_VALID(pAddress) ( !!((pAddress)->fFlags & DBGFADDRESS_FLAGS_VALID) )
116/** Checks if the address is flagged as within the HMA. */
117#define DBGFADDRESS_IS_HMA(pAddress) ( !!((pAddress)->fFlags & DBGFADDRESS_FLAGS_HMA) )
118/** @} */
119
120VMMR3DECL(int) DBGFR3AddrFromSelOff(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off);
121VMMR3DECL(int) DBGFR3AddrFromSelInfoOff(PVM pVM, PDBGFADDRESS pAddress, PCDBGFSELINFO pSelInfo, RTUINTPTR off);
122VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromFlat(PVM pVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr);
123VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromPhys(PVM pVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr);
124VMMR3DECL(bool) DBGFR3AddrIsValid(PVM pVM, PCDBGFADDRESS pAddress);
125VMMR3DECL(int) DBGFR3AddrToPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTGCPHYS pGCPhys);
126VMMR3DECL(int) DBGFR3AddrToHostPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys);
127VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr);
128VMMR3DECL(PDBGFADDRESS) DBGFR3AddrAdd(PDBGFADDRESS pAddress, RTGCUINTPTR uAddend);
129VMMR3DECL(PDBGFADDRESS) DBGFR3AddrSub(PDBGFADDRESS pAddress, RTGCUINTPTR uSubtrahend);
130
131
132
133
134/**
135 * VMM Debug Event Type.
136 */
137typedef enum DBGFEVENTTYPE
138{
139 /** Halt completed.
140 * This notifies that a halt command have been successfully completed.
141 */
142 DBGFEVENT_HALT_DONE = 0,
143 /** Detach completed.
144 * This notifies that the detach command have been successfully completed.
145 */
146 DBGFEVENT_DETACH_DONE,
147 /** The command from the debugger is not recognized.
148 * This means internal error or half implemented features.
149 */
150 DBGFEVENT_INVALID_COMMAND,
151
152
153 /** Fatal error.
154 * This notifies a fatal error in the VMM and that the debugger get's a
155 * chance to first hand information about the the problem.
156 */
157 DBGFEVENT_FATAL_ERROR = 100,
158 /** Breakpoint Hit.
159 * This notifies that a breakpoint installed by the debugger was hit. The
160 * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
161 */
162 DBGFEVENT_BREAKPOINT,
163 /** Breakpoint Hit in the Hypervisor.
164 * This notifies that a breakpoint installed by the debugger was hit. The
165 * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
166 */
167 DBGFEVENT_BREAKPOINT_HYPER,
168 /** Assertion in the Hypervisor (breakpoint instruction).
169 * This notifies that a breakpoint instruction was hit in the hypervisor context.
170 */
171 DBGFEVENT_ASSERTION_HYPER,
172 /** Single Stepped.
173 * This notifies that a single step operation was completed.
174 */
175 DBGFEVENT_STEPPED,
176 /** Single Stepped.
177 * This notifies that a hypervisor single step operation was completed.
178 */
179 DBGFEVENT_STEPPED_HYPER,
180 /** The developer have used the DBGFSTOP macro or the PDMDeviceDBGFSTOP function
181 * to bring up the debugger at a specific place.
182 */
183 DBGFEVENT_DEV_STOP,
184 /** The VM is terminating.
185 * When this notification is received, the debugger thread should detach ASAP.
186 */
187 DBGFEVENT_TERMINATING,
188
189 /** The usual 32-bit hack. */
190 DBGFEVENT_32BIT_HACK = 0x7fffffff
191} DBGFEVENTTYPE;
192
193
194/**
195 * The context of an event.
196 */
197typedef enum DBGFEVENTCTX
198{
199 /** The usual invalid entry. */
200 DBGFEVENTCTX_INVALID = 0,
201 /** Raw mode. */
202 DBGFEVENTCTX_RAW,
203 /** Recompiled mode. */
204 DBGFEVENTCTX_REM,
205 /** VMX / AVT mode. */
206 DBGFEVENTCTX_HWACCL,
207 /** Hypervisor context. */
208 DBGFEVENTCTX_HYPER,
209 /** Other mode */
210 DBGFEVENTCTX_OTHER,
211
212 /** The usual 32-bit hack */
213 DBGFEVENTCTX_32BIT_HACK = 0x7fffffff
214} DBGFEVENTCTX;
215
216/**
217 * VMM Debug Event.
218 */
219typedef struct DBGFEVENT
220{
221 /** Type. */
222 DBGFEVENTTYPE enmType;
223 /** Context */
224 DBGFEVENTCTX enmCtx;
225 /** Type specific data. */
226 union
227 {
228 /** Fatal error details. */
229 struct
230 {
231 /** The GC return code. */
232 int rc;
233 } FatalError;
234
235 /** Source location. */
236 struct
237 {
238 /** File name. */
239 R3PTRTYPE(const char *) pszFile;
240 /** Function name. */
241 R3PTRTYPE(const char *) pszFunction;
242 /** Message. */
243 R3PTRTYPE(const char *) pszMessage;
244 /** Line number. */
245 unsigned uLine;
246 } Src;
247
248 /** Assertion messages. */
249 struct
250 {
251 /** The first message. */
252 R3PTRTYPE(const char *) pszMsg1;
253 /** The second message. */
254 R3PTRTYPE(const char *) pszMsg2;
255 } Assert;
256
257 /** Breakpoint. */
258 struct DBGFEVENTBP
259 {
260 /** The identifier of the breakpoint which was hit. */
261 RTUINT iBp;
262 } Bp;
263 /** Padding for ensuring that the structure is 8 byte aligned. */
264 uint64_t au64Padding[4];
265 } u;
266} DBGFEVENT;
267/** Pointer to VMM Debug Event. */
268typedef DBGFEVENT *PDBGFEVENT;
269/** Pointer to const VMM Debug Event. */
270typedef const DBGFEVENT *PCDBGFEVENT;
271
272
273/** @def DBGFSTOP
274 * Stops the debugger raising a DBGFEVENT_DEVELOPER_STOP event.
275 *
276 * @returns VBox status code which must be propagated up to EM if not VINF_SUCCESS.
277 * @param pVM VM Handle.
278 */
279#ifdef VBOX_STRICT
280# define DBGFSTOP(pVM) DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL)
281#else
282# define DBGFSTOP(pVM) VINF_SUCCESS
283#endif
284
285VMMR3DECL(int) DBGFR3Init(PVM pVM);
286VMMR3DECL(int) DBGFR3Term(PVM pVM);
287VMMR3DECL(void) DBGFR3Relocate(PVM pVM, RTGCINTPTR offDelta);
288VMMR3DECL(int) DBGFR3VMMForcedAction(PVM pVM);
289VMMR3DECL(int) DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent);
290VMMR3DECL(int) DBGFR3EventSrc(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, ...);
291VMMR3DECL(int) DBGFR3EventSrcV(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, va_list args);
292VMMR3DECL(int) DBGFR3EventAssertion(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszMsg1, const char *pszMsg2);
293VMMR3DECL(int) DBGFR3EventBreakpoint(PVM pVM, DBGFEVENTTYPE enmEvent);
294VMMR3DECL(int) DBGFR3Attach(PVM pVM);
295VMMR3DECL(int) DBGFR3Detach(PVM pVM);
296VMMR3DECL(int) DBGFR3EventWait(PVM pVM, unsigned cMillies, PCDBGFEVENT *ppEvent);
297VMMR3DECL(int) DBGFR3Halt(PVM pVM);
298VMMR3DECL(bool) DBGFR3IsHalted(PVM pVM);
299VMMR3DECL(bool) DBGFR3CanWait(PVM pVM);
300VMMR3DECL(int) DBGFR3Resume(PVM pVM);
301VMMR3DECL(int) DBGFR3Step(PVM pVM, VMCPUID idCpu);
302VMMR3DECL(int) DBGFR3PrgStep(PVMCPU pVCpu);
303
304
305/** Breakpoint type. */
306typedef enum DBGFBPTYPE
307{
308 /** Free breakpoint entry. */
309 DBGFBPTYPE_FREE = 0,
310 /** Debug register. */
311 DBGFBPTYPE_REG,
312 /** INT 3 instruction. */
313 DBGFBPTYPE_INT3,
314 /** Recompiler. */
315 DBGFBPTYPE_REM,
316 /** ensure 32-bit size. */
317 DBGFBPTYPE_32BIT_HACK = 0x7fffffff
318} DBGFBPTYPE;
319
320
321/**
322 * A Breakpoint.
323 */
324typedef struct DBGFBP
325{
326 /** The number of breakpoint hits. */
327 uint64_t cHits;
328 /** The hit number which starts to trigger the breakpoint. */
329 uint64_t iHitTrigger;
330 /** The hit number which stops triggering the breakpoint (disables it).
331 * Use ~(uint64_t)0 if it should never stop. */
332 uint64_t iHitDisable;
333 /** The Flat GC address of the breakpoint.
334 * (PC register value if REM type?) */
335 RTGCUINTPTR GCPtr;
336 /** The breakpoint id. */
337 RTUINT iBp;
338 /** The breakpoint status - enabled or disabled. */
339 bool fEnabled;
340
341 /** The breakpoint type. */
342 DBGFBPTYPE enmType;
343
344#if GC_ARCH_BITS == 64
345 uint32_t u32Padding;
346#endif
347
348 /** Union of type specific data. */
349 union
350 {
351 /** Debug register data. */
352 struct DBGFBPREG
353 {
354 /** The debug register number. */
355 uint8_t iReg;
356 /** The access type (one of the X86_DR7_RW_* value). */
357 uint8_t fType;
358 /** The access size. */
359 uint8_t cb;
360 } Reg;
361 /** Recompiler breakpoint data. */
362 struct DBGFBPINT3
363 {
364 /** The byte value we replaced by the INT 3 instruction. */
365 uint8_t bOrg;
366 } Int3;
367
368 /** Recompiler breakpoint data. */
369 struct DBGFBPREM
370 {
371 /** nothing yet */
372 uint8_t fDummy;
373 } Rem;
374 /** Paddind to ensure that the size is identical on win32 and linux. */
375 uint64_t u64Padding;
376 } u;
377} DBGFBP;
378
379/** Pointer to a breakpoint. */
380typedef DBGFBP *PDBGFBP;
381/** Pointer to a const breakpoint. */
382typedef const DBGFBP *PCDBGFBP;
383
384
385VMMR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp);
386VMMR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
387 uint8_t fType, uint8_t cb, PRTUINT piBp);
388VMMR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp);
389VMMR3DECL(int) DBGFR3BpClear(PVM pVM, RTUINT iBp);
390VMMR3DECL(int) DBGFR3BpEnable(PVM pVM, RTUINT iBp);
391VMMR3DECL(int) DBGFR3BpDisable(PVM pVM, RTUINT iBp);
392
393/**
394 * Breakpoint enumeration callback function.
395 *
396 * @returns VBox status code. Any failure will stop the enumeration.
397 * @param pVM The VM handle.
398 * @param pvUser The user argument.
399 * @param pBp Pointer to the breakpoint information. (readonly)
400 */
401typedef DECLCALLBACK(int) FNDBGFBPENUM(PVM pVM, void *pvUser, PCDBGFBP pBp);
402/** Pointer to a breakpoint enumeration callback function. */
403typedef FNDBGFBPENUM *PFNDBGFBPENUM;
404
405VMMR3DECL(int) DBGFR3BpEnum(PVM pVM, PFNDBGFBPENUM pfnCallback, void *pvUser);
406VMMDECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM);
407VMMDECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM);
408VMMDECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM);
409VMMDECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM);
410VMMDECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM);
411VMMDECL(bool) DBGFIsStepping(PVMCPU pVCpu);
412
413
414
415VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PVM pVM, VMCPUID idCpu);
416
417
418
419
420/** Pointer to a info helper callback structure. */
421typedef struct DBGFINFOHLP *PDBGFINFOHLP;
422/** Pointer to a const info helper callback structure. */
423typedef const struct DBGFINFOHLP *PCDBGFINFOHLP;
424
425/**
426 * Info helper callback structure.
427 */
428typedef struct DBGFINFOHLP
429{
430 /**
431 * Print formatted string.
432 *
433 * @param pHlp Pointer to this structure.
434 * @param pszFormat The format string.
435 * @param ... Arguments.
436 */
437 DECLCALLBACKMEMBER(void, pfnPrintf)(PCDBGFINFOHLP pHlp, const char *pszFormat, ...);
438
439 /**
440 * Print formatted string.
441 *
442 * @param pHlp Pointer to this structure.
443 * @param pszFormat The format string.
444 * @param args Argument list.
445 */
446 DECLCALLBACKMEMBER(void, pfnPrintfV)(PCDBGFINFOHLP pHlp, const char *pszFormat, va_list args);
447} DBGFINFOHLP;
448
449
450/**
451 * Info handler, device version.
452 *
453 * @param pDevIns Device instance which registered the info.
454 * @param pHlp Callback functions for doing output.
455 * @param pszArgs Argument string. Optional and specific to the handler.
456 */
457typedef DECLCALLBACK(void) FNDBGFHANDLERDEV(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
458/** Pointer to a FNDBGFHANDLERDEV function. */
459typedef FNDBGFHANDLERDEV *PFNDBGFHANDLERDEV;
460
461/**
462 * Info handler, driver version.
463 *
464 * @param pDrvIns Driver instance which registered the info.
465 * @param pHlp Callback functions for doing output.
466 * @param pszArgs Argument string. Optional and specific to the handler.
467 */
468typedef DECLCALLBACK(void) FNDBGFHANDLERDRV(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
469/** Pointer to a FNDBGFHANDLERDRV function. */
470typedef FNDBGFHANDLERDRV *PFNDBGFHANDLERDRV;
471
472/**
473 * Info handler, internal version.
474 *
475 * @param pVM The VM handle.
476 * @param pHlp Callback functions for doing output.
477 * @param pszArgs Argument string. Optional and specific to the handler.
478 */
479typedef DECLCALLBACK(void) FNDBGFHANDLERINT(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
480/** Pointer to a FNDBGFHANDLERINT function. */
481typedef FNDBGFHANDLERINT *PFNDBGFHANDLERINT;
482
483/**
484 * Info handler, external version.
485 *
486 * @param pvUser User argument.
487 * @param pHlp Callback functions for doing output.
488 * @param pszArgs Argument string. Optional and specific to the handler.
489 */
490typedef DECLCALLBACK(void) FNDBGFHANDLEREXT(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs);
491/** Pointer to a FNDBGFHANDLEREXT function. */
492typedef FNDBGFHANDLEREXT *PFNDBGFHANDLEREXT;
493
494
495/** @name Flags for the info registration functions.
496 * @{ */
497/** The handler must run on the EMT. */
498#define DBGFINFO_FLAGS_RUN_ON_EMT RT_BIT(0)
499/** @} */
500
501VMMR3DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler, PPDMDEVINS pDevIns);
502VMMR3DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns);
503VMMR3DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler);
504VMMR3DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags);
505VMMR3DECL(int) DBGFR3InfoRegisterExternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser);
506VMMR3DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName);
507VMMR3DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName);
508VMMR3DECL(int) DBGFR3InfoDeregisterInternal(PVM pVM, const char *pszName);
509VMMR3DECL(int) DBGFR3InfoDeregisterExternal(PVM pVM, const char *pszName);
510VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
511VMMR3DECL(int) DBGFR3InfoLogRel(PVM pVM, const char *pszName, const char *pszArgs);
512VMMR3DECL(int) DBGFR3InfoStdErr(PVM pVM, const char *pszName, const char *pszArgs);
513
514/** @def DBGFR3InfoLog
515 * Display a piece of info writing to the log if enabled.
516 *
517 * @param pVM VM handle.
518 * @param pszName The identifier of the info to display.
519 * @param pszArgs Arguments to the info handler.
520 */
521#ifdef LOG_ENABLED
522#define DBGFR3InfoLog(pVM, pszName, pszArgs) \
523 do { \
524 if (LogIsEnabled()) \
525 DBGFR3Info(pVM, pszName, pszArgs, NULL); \
526 } while (0)
527#else
528#define DBGFR3InfoLog(pVM, pszName, pszArgs) do { } while (0)
529#endif
530
531/**
532 * Enumeration callback for use with DBGFR3InfoEnum.
533 *
534 * @returns VBox status code.
535 * A status code indicating failure will end the enumeration
536 * and DBGFR3InfoEnum will return with that status code.
537 * @param pVM VM handle.
538 * @param pszName Info identifier name.
539 * @param pszDesc The description.
540 */
541typedef DECLCALLBACK(int) FNDBGFINFOENUM(PVM pVM, const char *pszName, const char *pszDesc, void *pvUser);
542/** Pointer to a FNDBGFINFOENUM function. */
543typedef FNDBGFINFOENUM *PFNDBGFINFOENUM;
544
545VMMR3DECL(int) DBGFR3InfoEnum(PVM pVM, PFNDBGFINFOENUM pfnCallback, void *pvUser);
546VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogHlp(void);
547VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogRelHlp(void);
548
549
550
551VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings);
552VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings);
553VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings);
554
555
556
557/** Max length (including '\\0') of a symbol name. */
558#define DBGF_SYMBOL_NAME_LENGTH 512
559
560/**
561 * Debug symbol.
562 */
563typedef struct DBGFSYMBOL
564{
565 /** Symbol value (address). */
566 RTGCUINTPTR Value;
567 /** Symbol size. */
568 uint32_t cb;
569 /** Symbol Flags. (reserved). */
570 uint32_t fFlags;
571 /** Symbol name. */
572 char szName[DBGF_SYMBOL_NAME_LENGTH];
573} DBGFSYMBOL;
574/** Pointer to debug symbol. */
575typedef DBGFSYMBOL *PDBGFSYMBOL;
576/** Pointer to const debug symbol. */
577typedef const DBGFSYMBOL *PCDBGFSYMBOL;
578
579/**
580 * Debug line number information.
581 */
582typedef struct DBGFLINE
583{
584 /** Address. */
585 RTGCUINTPTR Address;
586 /** Line number. */
587 uint32_t uLineNo;
588 /** Filename. */
589 char szFilename[260];
590} DBGFLINE;
591/** Pointer to debug line number. */
592typedef DBGFLINE *PDBGFLINE;
593/** Pointer to const debug line number. */
594typedef const DBGFLINE *PCDBGFLINE;
595
596/** @name Address spaces aliases.
597 * @{ */
598/** The guest global address space. */
599#define DBGF_AS_GLOBAL ((RTDBGAS)-1)
600/** The guest kernel address space.
601 * This is usually resolves to the same as DBGF_AS_GLOBAL. */
602#define DBGF_AS_KERNEL ((RTDBGAS)-2)
603/** The physical address space. */
604#define DBGF_AS_PHYS ((RTDBGAS)-3)
605/** Raw-mode context. */
606#define DBGF_AS_RC ((RTDBGAS)-4)
607/** Ring-0 context. */
608#define DBGF_AS_R0 ((RTDBGAS)-5)
609/** Raw-mode context and then global guest context.
610 * When used for looking up information, it works as if the call was first made
611 * with DBGF_AS_RC and then on failure with DBGF_AS_GLOBAL. When called for
612 * making address space changes, it works as if DBGF_AS_RC was used. */
613#define DBGF_AS_RC_AND_GC_GLOBAL ((RTDBGAS)-6)
614
615/** The first special one. */
616#define DBGF_AS_FIRST DBGF_AS_RC_AND_GC_GLOBAL
617/** The last special one. */
618#define DBGF_AS_LAST DBGF_AS_GLOBAL
619/** The number of special address space handles. */
620#define DBGF_AS_COUNT (6U)
621/** Converts an alias handle to an array index. */
622#define DBGF_AS_ALIAS_2_INDEX(hAlias) \
623 ( (uintptr_t)(hAlias) - (uintptr_t)DBGF_AS_FIRST )
624/** Predicat macro that check if the specified handle is an alias. */
625#define DBGF_AS_IS_ALIAS(hAlias) \
626 ( DBGF_AS_ALIAS_2_INDEX(hAlias) < DBGF_AS_COUNT )
627/** Predicat macro that check if the specified alias is a fixed one or not. */
628#define DBGF_AS_IS_FIXED_ALIAS(hAlias) \
629 ( DBGF_AS_ALIAS_2_INDEX(hAlias) < (uintptr_t)DBGF_AS_PHYS - (uintptr_t)DBGF_AS_FIRST + 1U )
630
631/** @} */
632
633VMMR3DECL(int) DBGFR3AsAdd(PVM pVM, RTDBGAS hDbgAs, RTPROCESS ProcId);
634VMMR3DECL(int) DBGFR3AsDelete(PVM pVM, RTDBGAS hDbgAs);
635VMMR3DECL(int) DBGFR3AsSetAlias(PVM pVM, RTDBGAS hAlias, RTDBGAS hAliasFor);
636VMMR3DECL(RTDBGAS) DBGFR3AsResolve(PVM pVM, RTDBGAS hAlias);
637VMMR3DECL(RTDBGAS) DBGFR3AsResolveAndRetain(PVM pVM, RTDBGAS hAlias);
638VMMR3DECL(RTDBGAS) DBGFR3AsQueryByName(PVM pVM, const char *pszName);
639VMMR3DECL(RTDBGAS) DBGFR3AsQueryByPid(PVM pVM, RTPROCESS ProcId);
640
641VMMR3DECL(int) DBGFR3AsLoadImage(PVM pVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
642VMMR3DECL(int) DBGFR3AsLoadMap(PVM pVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags);
643VMMR3DECL(int) DBGFR3AsLinkModule(PVM pVM, RTDBGAS hDbgAs, RTDBGMOD hMod, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
644
645VMMR3DECL(int) DBGFR3AsSymbolByAddr(PVM pVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
646VMMR3DECL(PRTDBGSYMBOL) DBGFR3AsSymbolByAddrA(PVM pVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, PRTGCINTPTR poffDisp, PRTDBGMOD phMod);
647VMMR3DECL(int) DBGFR3AsSymbolByName(PVM pVM, RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
648
649/* The following are soon to be obsoleted: */
650VMMR3DECL(int) DBGFR3ModuleLoad(PVM pVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage);
651VMMR3DECL(void) DBGFR3ModuleRelocate(PVM pVM, RTGCUINTPTR OldImageBase, RTGCUINTPTR NewImageBase, RTGCUINTPTR cbImage,
652 const char *pszFilename, const char *pszName);
653VMMR3DECL(int) DBGFR3SymbolAdd(PVM pVM, RTGCUINTPTR ModuleAddress, RTGCUINTPTR SymbolAddress, RTUINT cbSymbol, const char *pszSymbol);
654VMMR3DECL(int) DBGFR3SymbolByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFSYMBOL pSymbol);
655VMMR3DECL(int) DBGFR3SymbolByName(PVM pVM, const char *pszSymbol, PDBGFSYMBOL pSymbol);
656
657VMMR3DECL(int) DBGFR3LineByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine);
658VMMR3DECL(PDBGFLINE) DBGFR3LineByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
659VMMR3DECL(void) DBGFR3LineFree(PDBGFLINE pLine);
660
661
662/**
663 * Return type.
664 */
665typedef enum DBGFRETRUNTYPE
666{
667 /** The usual invalid 0 value. */
668 DBGFRETURNTYPE_INVALID = 0,
669 /** Near 16-bit return. */
670 DBGFRETURNTYPE_NEAR16,
671 /** Near 32-bit return. */
672 DBGFRETURNTYPE_NEAR32,
673 /** Near 64-bit return. */
674 DBGFRETURNTYPE_NEAR64,
675 /** Far 16:16 return. */
676 DBGFRETURNTYPE_FAR16,
677 /** Far 16:32 return. */
678 DBGFRETURNTYPE_FAR32,
679 /** Far 16:64 return. */
680 DBGFRETURNTYPE_FAR64,
681 /** 16-bit iret return (e.g. real or 286 protect mode). */
682 DBGFRETURNTYPE_IRET16,
683 /** 32-bit iret return. */
684 DBGFRETURNTYPE_IRET32,
685 /** 32-bit iret return. */
686 DBGFRETURNTYPE_IRET32_PRIV,
687 /** 32-bit iret return to V86 mode. */
688 DBGFRETURNTYPE_IRET32_V86,
689 /** @todo 64-bit iret return. */
690 DBGFRETURNTYPE_IRET64,
691 /** The end of the valid return types. */
692 DBGFRETURNTYPE_END,
693 /** The usual 32-bit blowup. */
694 DBGFRETURNTYPE_32BIT_HACK = 0x7fffffff
695} DBGFRETURNTYPE;
696
697/**
698 * Figures the size of the return state on the stack.
699 *
700 * @returns number of bytes. 0 if invalid parameter.
701 * @param enmRetType The type of return.
702 */
703DECLINLINE(unsigned) DBGFReturnTypeSize(DBGFRETURNTYPE enmRetType)
704{
705 switch (enmRetType)
706 {
707 case DBGFRETURNTYPE_NEAR16: return 2;
708 case DBGFRETURNTYPE_NEAR32: return 4;
709 case DBGFRETURNTYPE_NEAR64: return 8;
710 case DBGFRETURNTYPE_FAR16: return 4;
711 case DBGFRETURNTYPE_FAR32: return 4;
712 case DBGFRETURNTYPE_FAR64: return 8;
713 case DBGFRETURNTYPE_IRET16: return 6;
714 case DBGFRETURNTYPE_IRET32: return 4*3;
715 case DBGFRETURNTYPE_IRET32_PRIV: return 4*5;
716 case DBGFRETURNTYPE_IRET32_V86: return 4*9;
717 case DBGFRETURNTYPE_IRET64:
718 default:
719 return 0;
720 }
721}
722
723
724/** Pointer to stack frame info. */
725typedef struct DBGFSTACKFRAME *PDBGFSTACKFRAME;
726/** Pointer to const stack frame info. */
727typedef struct DBGFSTACKFRAME const *PCDBGFSTACKFRAME;
728/**
729 * Info about a stack frame.
730 */
731typedef struct DBGFSTACKFRAME
732{
733 /** Frame number. */
734 uint32_t iFrame;
735 /** Frame flags. */
736 uint32_t fFlags;
737 /** The frame address.
738 * The off member is [e|r]bp and the Sel member is ss. */
739 DBGFADDRESS AddrFrame;
740 /** The stack address of the frame.
741 * The off member is [e|r]sp and the Sel member is ss. */
742 DBGFADDRESS AddrStack;
743 /** The program counter (PC) address of the frame.
744 * The off member is [e|r]ip and the Sel member is cs. */
745 DBGFADDRESS AddrPC;
746 /** Pointer to the symbol nearest the program counter (PC). NULL if not found. */
747 PRTDBGSYMBOL pSymPC;
748 /** Pointer to the linnumber nearest the program counter (PC). NULL if not found. */
749 PDBGFLINE pLinePC;
750
751 /** The return frame address.
752 * The off member is [e|r]bp and the Sel member is ss. */
753 DBGFADDRESS AddrReturnFrame;
754 /** The return stack address.
755 * The off member is [e|r]sp and the Sel member is ss. */
756 DBGFADDRESS AddrReturnStack;
757 /** The way this frame returns to the next one. */
758 DBGFRETURNTYPE enmReturnType;
759
760 /** The program counter (PC) address which the frame returns to.
761 * The off member is [e|r]ip and the Sel member is cs. */
762 DBGFADDRESS AddrReturnPC;
763 /** Pointer to the symbol nearest the return PC. NULL if not found. */
764 PRTDBGSYMBOL pSymReturnPC;
765 /** Pointer to the linnumber nearest the return PC. NULL if not found. */
766 PDBGFLINE pLineReturnPC;
767
768 /** 32-bytes of stack arguments. */
769 union
770 {
771 /** 64-bit view */
772 uint64_t au64[4];
773 /** 32-bit view */
774 uint32_t au32[8];
775 /** 16-bit view */
776 uint16_t au16[16];
777 /** 8-bit view */
778 uint8_t au8[32];
779 } Args;
780
781 /** Pointer to the next frame.
782 * Might not be used in some cases, so consider it internal. */
783 PCDBGFSTACKFRAME pNextInternal;
784 /** Pointer to the first frame.
785 * Might not be used in some cases, so consider it internal. */
786 PCDBGFSTACKFRAME pFirstInternal;
787} DBGFSTACKFRAME;
788
789/** @name DBGFSTACKFRAME Flags.
790 * @{ */
791/** Set if the content of the frame is filled in by DBGFR3StackWalk() and can be used
792 * to construct the next frame. */
793#define DBGFSTACKFRAME_FLAGS_ALL_VALID RT_BIT(0)
794/** This is the last stack frame we can read.
795 * This flag is not set if the walk stop because of max dept or recursion. */
796#define DBGFSTACKFRAME_FLAGS_LAST RT_BIT(1)
797/** This is the last record because we detected a loop. */
798#define DBGFSTACKFRAME_FLAGS_LOOP RT_BIT(2)
799/** This is the last record because we reached the maximum depth. */
800#define DBGFSTACKFRAME_FLAGS_MAX_DEPTH RT_BIT(3)
801/** 16-bit frame. */
802#define DBGFSTACKFRAME_FLAGS_16BIT RT_BIT(4)
803/** 32-bit frame. */
804#define DBGFSTACKFRAME_FLAGS_32BIT RT_BIT(5)
805/** 64-bit frame. */
806#define DBGFSTACKFRAME_FLAGS_64BIT RT_BIT(6)
807/** @} */
808
809/** @name DBGFCODETYPE
810 * @{ */
811typedef enum DBGFCODETYPE
812{
813 /** The usual invalid 0 value. */
814 DBGFCODETYPE_INVALID = 0,
815 /** Stack walk for guest code. */
816 DBGFCODETYPE_GUEST,
817 /** Stack walk for hypervisor code. */
818 DBGFCODETYPE_HYPER,
819 /** Stack walk for ring 0 code. */
820 DBGFCODETYPE_RING0,
821 /** The usual 32-bit blowup. */
822 DBGFCODETYPE_32BIT_HACK = 0x7fffffff
823} DBGFCODETYPE;
824/** @} */
825
826VMMR3DECL(int) DBGFR3StackWalkBegin(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame);
827VMMR3DECL(int) DBGFR3StackWalkBeginEx(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFADDRESS pAddrFrame,
828 PCDBGFADDRESS pAddrStack,PCDBGFADDRESS pAddrPC,
829 DBGFRETURNTYPE enmReturnType, PCDBGFSTACKFRAME *ppFirstFrame);
830VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent);
831VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame);
832
833
834
835
836/** Flags to pass to DBGFR3DisasInstrEx().
837 * @{ */
838/** Disassemble the current guest instruction, with annotations. */
839#define DBGF_DISAS_FLAGS_CURRENT_GUEST RT_BIT(0)
840/** Disassemble the current hypervisor instruction, with annotations. */
841#define DBGF_DISAS_FLAGS_CURRENT_HYPER RT_BIT(1)
842/** No annotations for current context. */
843#define DBGF_DISAS_FLAGS_NO_ANNOTATION RT_BIT(2)
844/** No symbol lookup. */
845#define DBGF_DISAS_FLAGS_NO_SYMBOLS RT_BIT(3)
846/** No instruction bytes. */
847#define DBGF_DISAS_FLAGS_NO_BYTES RT_BIT(4)
848/** No address in the output. */
849#define DBGF_DISAS_FLAGS_NO_ADDRESS RT_BIT(5)
850/** @} */
851
852/** Special flat selector. */
853#define DBGF_SEL_FLAT 1
854
855VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, unsigned fFlags, char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr);
856VMMR3DECL(int) DBGFR3DisasInstrCurrent(PVMCPU pVCpu, char *pszOutput, uint32_t cbOutput);
857VMMR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVMCPU pVCpu, const char *pszPrefix);
858
859/** @def DBGFR3DisasInstrCurrentLog
860 * Disassembles the current guest context instruction and writes it to the log.
861 * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
862 */
863#ifdef LOG_ENABLED
864# define DBGFR3DisasInstrCurrentLog(pVCpu, pszPrefix) \
865 do { \
866 if (LogIsEnabled()) \
867 DBGFR3DisasInstrCurrentLogInternal(pVCpu, pszPrefix); \
868 } while (0)
869#else
870# define DBGFR3DisasInstrCurrentLog(pVCpu, pszPrefix) do { } while (0)
871#endif
872
873VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr);
874
875/** @def DBGFR3DisasInstrLog
876 * Disassembles the specified guest context instruction and writes it to the log.
877 * Addresses will be attempted resolved to symbols.
878 * @thread Any EMT.
879 */
880#ifdef LOG_ENABLED
881# define DBGFR3DisasInstrLog(pVCpu, Sel, GCPtr) \
882 do { \
883 if (LogIsEnabled()) \
884 DBGFR3DisasInstrLogInternal(pVCpu, Sel, GCPtr); \
885 } while (0)
886#else
887# define DBGFR3DisasInstrLog(pVCpu, Sel, GCPtr) do { } while (0)
888#endif
889
890
891VMMR3DECL(int) DBGFR3MemScan(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, RTGCUINTPTR uAlign,
892 const void *pvNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress);
893VMMR3DECL(int) DBGFR3MemRead(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead);
894VMMR3DECL(int) DBGFR3MemReadString(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cbBuf);
895VMMR3DECL(int) DBGFR3MemWrite(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void const *pvBuf, size_t cbRead);
896
897
898/** @name DBGFR3SelQueryInfo flags.
899 * @{ */
900/** Get the info from the guest descriptor table. */
901#define DBGFSELQI_FLAGS_DT_GUEST UINT32_C(0)
902/** Get the info from the shadow descriptor table.
903 * Only works in raw-mode. */
904#define DBGFSELQI_FLAGS_DT_SHADOW UINT32_C(1)
905/** If currently executing in in 64-bit mode, blow up data selectors. */
906#define DBGFSELQI_FLAGS_DT_ADJ_64BIT_MODE UINT32_C(2)
907/** @} */
908VMMR3DECL(int) DBGFR3SelQueryInfo(PVM pVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo);
909
910
911/**
912 * Guest OS digger interface identifier.
913 *
914 * This is for use together with PDBGFR3QueryInterface and is used to
915 * obtain access to optional interfaces.
916 */
917typedef enum DBGFOSINTERFACE
918{
919 /** The usual invalid entry. */
920 DBGFOSINTERFACE_INVALID = 0,
921 /** Process info. */
922 DBGFOSINTERFACE_PROCESS,
923 /** Thread info. */
924 DBGFOSINTERFACE_THREAD,
925 /** The end of the valid entries. */
926 DBGFOSINTERFACE_END,
927 /** The usual 32-bit type blowup. */
928 DBGFOSINTERFACE_32BIT_HACK = 0x7fffffff
929} DBGFOSINTERFACE;
930/** Pointer to a Guest OS digger interface identifier. */
931typedef DBGFOSINTERFACE *PDBGFOSINTERFACE;
932/** Pointer to a const Guest OS digger interface identifier. */
933typedef DBGFOSINTERFACE const *PCDBGFOSINTERFACE;
934
935
936/**
937 * Guest OS Digger Registration Record.
938 *
939 * This is used with the DBGFR3OSRegister() API.
940 */
941typedef struct DBGFOSREG
942{
943 /** Magic value (DBGFOSREG_MAGIC). */
944 uint32_t u32Magic;
945 /** Flags. Reserved. */
946 uint32_t fFlags;
947 /** The size of the instance data. */
948 uint32_t cbData;
949 /** Operative System name. */
950 char szName[24];
951
952 /**
953 * Constructs the instance.
954 *
955 * @returns VBox status code.
956 * @param pVM Pointer to the shared VM structure.
957 * @param pvData Pointer to the instance data.
958 */
959 DECLCALLBACKMEMBER(int, pfnConstruct)(PVM pVM, void *pvData);
960
961 /**
962 * Destroys the instance.
963 *
964 * @param pVM Pointer to the shared VM structure.
965 * @param pvData Pointer to the instance data.
966 */
967 DECLCALLBACKMEMBER(void, pfnDestruct)(PVM pVM, void *pvData);
968
969 /**
970 * Probes the guest memory for OS finger prints.
971 *
972 * No setup or so is performed, it will be followed by a call to pfnInit
973 * or pfnRefresh that should take care of that.
974 *
975 * @returns true if is an OS handled by this module, otherwise false.
976 * @param pVM Pointer to the shared VM structure.
977 * @param pvData Pointer to the instance data.
978 */
979 DECLCALLBACKMEMBER(bool, pfnProbe)(PVM pVM, void *pvData);
980
981 /**
982 * Initializes a fresly detected guest, loading symbols and such useful stuff.
983 *
984 * This is called after pfnProbe.
985 *
986 * @returns VBox status code.
987 * @param pVM Pointer to the shared VM structure.
988 * @param pvData Pointer to the instance data.
989 */
990 DECLCALLBACKMEMBER(int, pfnInit)(PVM pVM, void *pvData);
991
992 /**
993 * Refreshes symbols and stuff following a redetection of the same OS.
994 *
995 * This is called after pfnProbe.
996 *
997 * @returns VBox status code.
998 * @param pVM Pointer to the shared VM structure.
999 * @param pvData Pointer to the instance data.
1000 */
1001 DECLCALLBACKMEMBER(int, pfnRefresh)(PVM pVM, void *pvData);
1002
1003 /**
1004 * Terminates an OS when a new (or none) OS has been detected,
1005 * and before destruction.
1006 *
1007 * This is called after pfnProbe and if needed before pfnDestruct.
1008 *
1009 * @param pVM Pointer to the shared VM structure.
1010 * @param pvData Pointer to the instance data.
1011 */
1012 DECLCALLBACKMEMBER(void, pfnTerm)(PVM pVM, void *pvData);
1013
1014 /**
1015 * Queries the version of the running OS.
1016 *
1017 * This is only called after pfnInit().
1018 *
1019 * @returns VBox status code.
1020 * @param pVM Pointer to the shared VM structure.
1021 * @param pvData Pointer to the instance data.
1022 * @param pszVersion Where to store the version string.
1023 * @param cchVersion The size of the version string buffer.
1024 */
1025 DECLCALLBACKMEMBER(int, pfnQueryVersion)(PVM pVM, void *pvData, char *pszVersion, size_t cchVersion);
1026
1027 /**
1028 * Queries the pointer to a interface.
1029 *
1030 * This is called after pfnProbe.
1031 *
1032 * @returns Pointer to the interface if available, NULL if not available.
1033 * @param pVM Pointer to the shared VM structure.
1034 * @param pvData Pointer to the instance data.
1035 * @param enmIf The interface identifier.
1036 */
1037 DECLCALLBACKMEMBER(void *, pfnQueryInterface)(PVM pVM, void *pvData, DBGFOSINTERFACE enmIf);
1038
1039 /** Trailing magic (DBGFOSREG_MAGIC). */
1040 uint32_t u32EndMagic;
1041} DBGFOSREG;
1042/** Pointer to a Guest OS digger registration record. */
1043typedef DBGFOSREG *PDBGFOSREG;
1044/** Pointer to a const Guest OS digger registration record. */
1045typedef DBGFOSREG const *PCDBGFOSREG;
1046
1047/** Magic value for DBGFOSREG::u32Magic and DBGFOSREG::u32EndMagic. (Hitomi Kanehara) */
1048#define DBGFOSREG_MAGIC 0x19830808
1049
1050VMMR3DECL(int) DBGFR3OSRegister(PVM pVM, PCDBGFOSREG pReg);
1051VMMR3DECL(int) DBGFR3OSDeregister(PVM pVM, PCDBGFOSREG pReg);
1052VMMR3DECL(int) DBGFR3OSDetect(PVM pVM, char *pszName, size_t cchName);
1053VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion);
1054VMMR3DECL(void *) DBGFR3OSQueryInterface(PVM pVM, DBGFOSINTERFACE enmIf);
1055
1056/** @} */
1057
1058
1059RT_C_DECLS_END
1060
1061#endif
1062
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