VirtualBox

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

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

include/VBox/*.h: Mark which components the header files relate to.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use