VirtualBox

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

Last change on this file since 21088 was 20374, checked in by vboxsync, 16 years ago

*: s/RT_\(BEGIN|END\)_DECLS/RT_C_DECLS_\1/g

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.8 KB
Line 
1/** @file
2 * DBGF - Debugger Facility.
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
640/* The following are soon to be obsoleted: */
641VMMR3DECL(int) DBGFR3ModuleLoad(PVM pVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage);
642VMMR3DECL(void) DBGFR3ModuleRelocate(PVM pVM, RTGCUINTPTR OldImageBase, RTGCUINTPTR NewImageBase, RTGCUINTPTR cbImage,
643 const char *pszFilename, const char *pszName);
644VMMR3DECL(int) DBGFR3SymbolAdd(PVM pVM, RTGCUINTPTR ModuleAddress, RTGCUINTPTR SymbolAddress, RTUINT cbSymbol, const char *pszSymbol);
645VMMR3DECL(int) DBGFR3SymbolByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFSYMBOL pSymbol);
646VMMR3DECL(int) DBGFR3SymbolByName(PVM pVM, const char *pszSymbol, PDBGFSYMBOL pSymbol);
647VMMR3DECL(PDBGFSYMBOL) DBGFR3SymbolByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
648VMMR3DECL(PDBGFSYMBOL) DBGFR3SymbolByNameAlloc(PVM pVM, const char *pszSymbol);
649VMMR3DECL(void) DBGFR3SymbolFree(PDBGFSYMBOL pSymbol);
650VMMR3DECL(int) DBGFR3LineByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine);
651VMMR3DECL(PDBGFLINE) DBGFR3LineByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
652VMMR3DECL(void) DBGFR3LineFree(PDBGFLINE pLine);
653
654
655/**
656 * Return type.
657 */
658typedef enum DBGFRETRUNTYPE
659{
660 /** The usual invalid 0 value. */
661 DBGFRETURNTYPE_INVALID = 0,
662 /** Near 16-bit return. */
663 DBGFRETURNTYPE_NEAR16,
664 /** Near 32-bit return. */
665 DBGFRETURNTYPE_NEAR32,
666 /** Near 64-bit return. */
667 DBGFRETURNTYPE_NEAR64,
668 /** Far 16:16 return. */
669 DBGFRETURNTYPE_FAR16,
670 /** Far 16:32 return. */
671 DBGFRETURNTYPE_FAR32,
672 /** Far 16:64 return. */
673 DBGFRETURNTYPE_FAR64,
674 /** 16-bit iret return (e.g. real or 286 protect mode). */
675 DBGFRETURNTYPE_IRET16,
676 /** 32-bit iret return. */
677 DBGFRETURNTYPE_IRET32,
678 /** 32-bit iret return. */
679 DBGFRETURNTYPE_IRET32_PRIV,
680 /** 32-bit iret return to V86 mode. */
681 DBGFRETURNTYPE_IRET32_V86,
682 /** @todo 64-bit iret return. */
683 DBGFRETURNTYPE_IRET64,
684 /** The end of the valid return types. */
685 DBGFRETURNTYPE_END,
686 /** The usual 32-bit blowup. */
687 DBGFRETURNTYPE_32BIT_HACK = 0x7fffffff
688} DBGFRETURNTYPE;
689
690/**
691 * Figures the size of the return state on the stack.
692 *
693 * @returns number of bytes. 0 if invalid parameter.
694 * @param enmRetType The type of return.
695 */
696DECLINLINE(unsigned) DBGFReturnTypeSize(DBGFRETURNTYPE enmRetType)
697{
698 switch (enmRetType)
699 {
700 case DBGFRETURNTYPE_NEAR16: return 2;
701 case DBGFRETURNTYPE_NEAR32: return 4;
702 case DBGFRETURNTYPE_NEAR64: return 8;
703 case DBGFRETURNTYPE_FAR16: return 4;
704 case DBGFRETURNTYPE_FAR32: return 4;
705 case DBGFRETURNTYPE_FAR64: return 8;
706 case DBGFRETURNTYPE_IRET16: return 6;
707 case DBGFRETURNTYPE_IRET32: return 4*3;
708 case DBGFRETURNTYPE_IRET32_PRIV: return 4*5;
709 case DBGFRETURNTYPE_IRET32_V86: return 4*9;
710 case DBGFRETURNTYPE_IRET64:
711 default:
712 return 0;
713 }
714}
715
716
717/** Pointer to stack frame info. */
718typedef struct DBGFSTACKFRAME *PDBGFSTACKFRAME;
719/** Pointer to const stack frame info. */
720typedef struct DBGFSTACKFRAME const *PCDBGFSTACKFRAME;
721/**
722 * Info about a stack frame.
723 */
724typedef struct DBGFSTACKFRAME
725{
726 /** Frame number. */
727 RTUINT iFrame;
728 /** Frame flags. */
729 RTUINT fFlags;
730 /** The frame address.
731 * The off member is [e|r]bp and the Sel member is ss. */
732 DBGFADDRESS AddrFrame;
733 /** The stack address of the frame.
734 * The off member is [e|r]sp and the Sel member is ss. */
735 DBGFADDRESS AddrStack;
736 /** The program counter (PC) address of the frame.
737 * The off member is [e|r]ip and the Sel member is cs. */
738 DBGFADDRESS AddrPC;
739 /** Pointer to the symbol nearest the program counter (PC). NULL if not found. */
740 PDBGFSYMBOL pSymPC;
741 /** Pointer to the linnumber nearest the program counter (PC). NULL if not found. */
742 PDBGFLINE pLinePC;
743
744 /** The return frame address.
745 * The off member is [e|r]bp and the Sel member is ss. */
746 DBGFADDRESS AddrReturnFrame;
747 /** The return stack address.
748 * The off member is [e|r]sp and the Sel member is ss. */
749 DBGFADDRESS AddrReturnStack;
750 /** The way this frame returns to the next one. */
751 DBGFRETURNTYPE enmReturnType;
752
753 /** The program counter (PC) address which the frame returns to.
754 * The off member is [e|r]ip and the Sel member is cs. */
755 DBGFADDRESS AddrReturnPC;
756 /** Pointer to the symbol nearest the return PC. NULL if not found. */
757 PDBGFSYMBOL pSymReturnPC;
758 /** Pointer to the linnumber nearest the return PC. NULL if not found. */
759 PDBGFLINE pLineReturnPC;
760
761 /** 32-bytes of stack arguments. */
762 union
763 {
764 /** 64-bit view */
765 uint64_t au64[4];
766 /** 32-bit view */
767 uint32_t au32[8];
768 /** 16-bit view */
769 uint16_t au16[16];
770 /** 8-bit view */
771 uint8_t au8[32];
772 } Args;
773
774 /** Pointer to the next frame.
775 * Might not be used in some cases, so consider it internal. */
776 PCDBGFSTACKFRAME pNextInternal;
777 /** Pointer to the first frame.
778 * Might not be used in some cases, so consider it internal. */
779 PCDBGFSTACKFRAME pFirstInternal;
780} DBGFSTACKFRAME;
781
782/** @name DBGFSTACKFRAME Flags.
783 * @{ */
784/** Set if the content of the frame is filled in by DBGFR3StackWalk() and can be used
785 * to construct the next frame. */
786#define DBGFSTACKFRAME_FLAGS_ALL_VALID RT_BIT(0)
787/** This is the last stack frame we can read.
788 * This flag is not set if the walk stop because of max dept or recursion. */
789#define DBGFSTACKFRAME_FLAGS_LAST RT_BIT(1)
790/** This is the last record because we detected a loop. */
791#define DBGFSTACKFRAME_FLAGS_LOOP RT_BIT(2)
792/** This is the last record because we reached the maximum depth. */
793#define DBGFSTACKFRAME_FLAGS_MAX_DEPTH RT_BIT(3)
794/** @} */
795
796/** @name DBGFCODETYPE
797 * @{ */
798typedef enum DBGFCODETYPE
799{
800 /** The usual invalid 0 value. */
801 DBGFCODETYPE_INVALID = 0,
802 /** Stack walk for guest code. */
803 DBGFCODETYPE_GUEST,
804 /** Stack walk for hypervisor code. */
805 DBGFCODETYPE_HYPER,
806 /** Stack walk for ring 0 code. */
807 DBGFCODETYPE_RING0,
808 /** The usual 32-bit blowup. */
809 DBGFCODETYPE_32BIT_HACK = 0x7fffffff
810} DBGFCODETYPE;
811/** @} */
812
813VMMR3DECL(int) DBGFR3StackWalkBegin(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame);
814VMMR3DECL(int) DBGFR3StackWalkBeginEx(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFADDRESS pAddrFrame,
815 PCDBGFADDRESS pAddrStack,PCDBGFADDRESS pAddrPC,
816 DBGFRETURNTYPE enmReturnType, PCDBGFSTACKFRAME *ppFirstFrame);
817VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent);
818VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame);
819
820
821
822
823/** Flags to pass to DBGFR3DisasInstrEx().
824 * @{ */
825/** Disassemble the current guest instruction, with annotations. */
826#define DBGF_DISAS_FLAGS_CURRENT_GUEST RT_BIT(0)
827/** Disassemble the current hypervisor instruction, with annotations. */
828#define DBGF_DISAS_FLAGS_CURRENT_HYPER RT_BIT(1)
829/** No annotations for current context. */
830#define DBGF_DISAS_FLAGS_NO_ANNOTATION RT_BIT(2)
831/** No symbol lookup. */
832#define DBGF_DISAS_FLAGS_NO_SYMBOLS RT_BIT(3)
833/** No instruction bytes. */
834#define DBGF_DISAS_FLAGS_NO_BYTES RT_BIT(4)
835/** No address in the output. */
836#define DBGF_DISAS_FLAGS_NO_ADDRESS RT_BIT(5)
837/** @} */
838
839/** Special flat selector. */
840#define DBGF_SEL_FLAT 1
841
842VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, unsigned fFlags, char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr);
843VMMR3DECL(int) DBGFR3DisasInstrCurrent(PVMCPU pVCpu, char *pszOutput, uint32_t cbOutput);
844VMMR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVMCPU pVCpu, const char *pszPrefix);
845
846/** @def DBGFR3DisasInstrCurrentLog
847 * Disassembles the current guest context instruction and writes it to the log.
848 * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
849 */
850#ifdef LOG_ENABLED
851# define DBGFR3DisasInstrCurrentLog(pVCpu, pszPrefix) \
852 do { \
853 if (LogIsEnabled()) \
854 DBGFR3DisasInstrCurrentLogInternal(pVCpu, pszPrefix); \
855 } while (0)
856#else
857# define DBGFR3DisasInstrCurrentLog(pVCpu, pszPrefix) do { } while (0)
858#endif
859
860VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr);
861
862/** @def DBGFR3DisasInstrLog
863 * Disassembles the specified guest context instruction and writes it to the log.
864 * Addresses will be attempted resolved to symbols.
865 * @thread Any EMT.
866 */
867#ifdef LOG_ENABLED
868# define DBGFR3DisasInstrLog(pVCpu, Sel, GCPtr) \
869 do { \
870 if (LogIsEnabled()) \
871 DBGFR3DisasInstrLogInternal(pVCpu, Sel, GCPtr); \
872 } while (0)
873#else
874# define DBGFR3DisasInstrLog(pVCpu, Sel, GCPtr) do { } while (0)
875#endif
876
877
878VMMR3DECL(int) DBGFR3MemScan(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, const uint8_t *pabNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress);
879VMMR3DECL(int) DBGFR3MemRead(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead);
880VMMR3DECL(int) DBGFR3MemReadString(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cbBuf);
881VMMR3DECL(int) DBGFR3MemWrite(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void const *pvBuf, size_t cbRead);
882
883
884/** @name DBGFR3SelQueryInfo flags.
885 * @{ */
886/** Get the info from the guest descriptor table. */
887#define DBGFSELQI_FLAGS_DT_GUEST UINT32_C(0)
888/** Get the info from the shadow descriptor table.
889 * Only works in raw-mode. */
890#define DBGFSELQI_FLAGS_DT_SHADOW UINT32_C(1)
891/** @} */
892VMMR3DECL(int) DBGFR3SelQueryInfo(PVM pVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo);
893
894
895/**
896 * Guest OS digger interface identifier.
897 *
898 * This is for use together with PDBGFR3QueryInterface and is used to
899 * obtain access to optional interfaces.
900 */
901typedef enum DBGFOSINTERFACE
902{
903 /** The usual invalid entry. */
904 DBGFOSINTERFACE_INVALID = 0,
905 /** Process info. */
906 DBGFOSINTERFACE_PROCESS,
907 /** Thread info. */
908 DBGFOSINTERFACE_THREAD,
909 /** The end of the valid entries. */
910 DBGFOSINTERFACE_END,
911 /** The usual 32-bit type blowup. */
912 DBGFOSINTERFACE_32BIT_HACK = 0x7fffffff
913} DBGFOSINTERFACE;
914/** Pointer to a Guest OS digger interface identifier. */
915typedef DBGFOSINTERFACE *PDBGFOSINTERFACE;
916/** Pointer to a const Guest OS digger interface identifier. */
917typedef DBGFOSINTERFACE const *PCDBGFOSINTERFACE;
918
919
920/**
921 * Guest OS Digger Registration Record.
922 *
923 * This is used with the DBGFR3OSRegister() API.
924 */
925typedef struct DBGFOSREG
926{
927 /** Magic value (DBGFOSREG_MAGIC). */
928 uint32_t u32Magic;
929 /** Flags. Reserved. */
930 uint32_t fFlags;
931 /** The size of the instance data. */
932 uint32_t cbData;
933 /** Operative System name. */
934 char szName[24];
935
936 /**
937 * Constructs the instance.
938 *
939 * @returns VBox status code.
940 * @param pVM Pointer to the shared VM structure.
941 * @param pvData Pointer to the instance data.
942 */
943 DECLCALLBACKMEMBER(int, pfnConstruct)(PVM pVM, void *pvData);
944
945 /**
946 * Destroys the instance.
947 *
948 * @param pVM Pointer to the shared VM structure.
949 * @param pvData Pointer to the instance data.
950 */
951 DECLCALLBACKMEMBER(void, pfnDestruct)(PVM pVM, void *pvData);
952
953 /**
954 * Probes the guest memory for OS finger prints.
955 *
956 * No setup or so is performed, it will be followed by a call to pfnInit
957 * or pfnRefresh that should take care of that.
958 *
959 * @returns true if is an OS handled by this module, otherwise false.
960 * @param pVM Pointer to the shared VM structure.
961 * @param pvData Pointer to the instance data.
962 */
963 DECLCALLBACKMEMBER(bool, pfnProbe)(PVM pVM, void *pvData);
964
965 /**
966 * Initializes a fresly detected guest, loading symbols and such useful stuff.
967 *
968 * This is called after pfnProbe.
969 *
970 * @returns VBox status code.
971 * @param pVM Pointer to the shared VM structure.
972 * @param pvData Pointer to the instance data.
973 */
974 DECLCALLBACKMEMBER(int, pfnInit)(PVM pVM, void *pvData);
975
976 /**
977 * Refreshes symbols and stuff following a redetection of the same OS.
978 *
979 * This is called after pfnProbe.
980 *
981 * @returns VBox status code.
982 * @param pVM Pointer to the shared VM structure.
983 * @param pvData Pointer to the instance data.
984 */
985 DECLCALLBACKMEMBER(int, pfnRefresh)(PVM pVM, void *pvData);
986
987 /**
988 * Terminates an OS when a new (or none) OS has been detected,
989 * and before destruction.
990 *
991 * This is called after pfnProbe and if needed before pfnDestruct.
992 *
993 * @param pVM Pointer to the shared VM structure.
994 * @param pvData Pointer to the instance data.
995 */
996 DECLCALLBACKMEMBER(void, pfnTerm)(PVM pVM, void *pvData);
997
998 /**
999 * Queries the version of the running OS.
1000 *
1001 * This is only called after pfnInit().
1002 *
1003 * @returns VBox status code.
1004 * @param pVM Pointer to the shared VM structure.
1005 * @param pvData Pointer to the instance data.
1006 * @param pszVersion Where to store the version string.
1007 * @param cchVersion The size of the version string buffer.
1008 */
1009 DECLCALLBACKMEMBER(int, pfnQueryVersion)(PVM pVM, void *pvData, char *pszVersion, size_t cchVersion);
1010
1011 /**
1012 * Queries the pointer to a interface.
1013 *
1014 * This is called after pfnProbe.
1015 *
1016 * @returns Pointer to the interface if available, NULL if not available.
1017 * @param pVM Pointer to the shared VM structure.
1018 * @param pvData Pointer to the instance data.
1019 * @param enmIf The interface identifier.
1020 */
1021 DECLCALLBACKMEMBER(void *, pfnQueryInterface)(PVM pVM, void *pvData, DBGFOSINTERFACE enmIf);
1022
1023 /** Trailing magic (DBGFOSREG_MAGIC). */
1024 uint32_t u32EndMagic;
1025} DBGFOSREG;
1026/** Pointer to a Guest OS digger registration record. */
1027typedef DBGFOSREG *PDBGFOSREG;
1028/** Pointer to a const Guest OS digger registration record. */
1029typedef DBGFOSREG const *PCDBGFOSREG;
1030
1031/** Magic value for DBGFOSREG::u32Magic and DBGFOSREG::u32EndMagic. (Hitomi Kanehara) */
1032#define DBGFOSREG_MAGIC 0x19830808
1033
1034VMMR3DECL(int) DBGFR3OSRegister(PVM pVM, PCDBGFOSREG pReg);
1035VMMR3DECL(int) DBGFR3OSDeregister(PVM pVM, PCDBGFOSREG pReg);
1036VMMR3DECL(int) DBGFR3OSDetect(PVM pVM, char *pszName, size_t cchName);
1037VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion);
1038VMMR3DECL(void *) DBGFR3OSQueryInterface(PVM pVM, DBGFOSINTERFACE enmIf);
1039
1040/** @} */
1041
1042
1043RT_C_DECLS_END
1044
1045#endif
1046
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