dbgf.h revision eff9bdfbd880a3e3d3fff3bfb36a4a598ea9d277
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * DBGF - Debugger Facility.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Copyright (C) 2006-2007 Sun Microsystems, Inc.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * This file is part of VirtualBox Open Source Edition (OSE), as
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * available from http://www.virtualbox.org. This file is free software;
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * you can redistribute it and/or modify it under the terms of the GNU
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * General Public License (GPL) as published by the Free Software
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Foundation, in version 2 as it comes in the "COPYING" file of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * The contents of this file may alternatively be used under the terms
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * of the Common Development and Distribution License Version 1.0
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * VirtualBox OSE distribution, in which case the provisions of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * CDDL are applicable instead of those of the GPL.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * You may elect to license modified versions of this file under the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * terms and conditions of either the GPL or the CDDL or both.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Clara, CA 95054 USA or visit http://www.sun.com if you need
4b5c8e93cab28d3c65ba9d407fd8f46e3be1db1cMatthew Ahrens * additional information or have any questions.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** @defgroup grp_dbgf The Debugger Facility API
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** @addgroup grp_dbgf_rz The RZ DBGF API
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy * @ingroup grp_dbgf
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren KennedyVMMRZDECL(int) DBGFRZTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6);
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyVMMRZDECL(int) DBGFRZTrap03Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Mixed address.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy /** The flat address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy /** The selector offset address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy /** The selector. DBGF_SEL_FLAT is a legal value. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy /** Flags describing further details about the address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** Pointer to a mixed address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** Pointer to a const mixed address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** @name DBGFADDRESS Flags.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** A 16:16 far address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** A 16:32 far address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** A 16:64 far address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** A flat address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** A physical address. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** A physical address. */
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy/** The address type mask. */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/** Set if the address is valid. */
#define DBGFADDRESS_IS_FLAT(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FLAT )
#define DBGFADDRESS_IS_PHYS(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_PHYS )
#define DBGFADDRESS_IS_FAR16(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR16 )
#define DBGFADDRESS_IS_FAR32(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR32 )
#define DBGFADDRESS_IS_FAR64(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR64 )
VMMR3DECL(int) DBGFR3AddrFromSelOff(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off);
VMMR3DECL(int) DBGFR3AddrToHostPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys);
VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr);
typedef enum DBGFEVENTTYPE
DBGFEVENT_HALT_DONE = 0,
typedef enum DBGFEVENTCTX
DBGFEVENTCTX_INVALID = 0,
} DBGFEVENTCTX;
typedef struct DBGFEVENT
int rc;
} FatalError;
unsigned uLine;
} Src;
} Assert;
struct DBGFEVENTBP
} Bp;
} DBGFEVENT;
#ifdef VBOX_STRICT
# define DBGFSTOP(pVM) DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL)
VMMR3DECL(int) DBGFR3EventSrc(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, ...);
VMMR3DECL(int) DBGFR3EventSrcV(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, va_list args);
VMMR3DECL(int) DBGFR3EventAssertion(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszMsg1, const char *pszMsg2);
typedef enum DBGFBPTYPE
DBGFBPTYPE_FREE = 0,
} DBGFBPTYPE;
typedef struct DBGFBP
bool fEnabled;
struct DBGFBPREG
} Reg;
struct DBGFBPINT3
} Int3;
struct DBGFBPREM
} Rem;
} DBGFBP;
VMMR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp);
VMMR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
VMMR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp);
typedef struct DBGFINFOHLP
} DBGFINFOHLP;
typedef DECLCALLBACK(void) FNDBGFHANDLERDEV(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
typedef DECLCALLBACK(void) FNDBGFHANDLERDRV(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
VMMR3DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler, PPDMDEVINS pDevIns);
VMMR3DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns);
VMMR3DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler);
VMMR3DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags);
VMMR3DECL(int) DBGFR3InfoRegisterExternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser);
#ifdef LOG_ENABLED
if (LogIsEnabled()) \
typedef DECLCALLBACK(int) FNDBGFINFOENUM(PVM pVM, const char *pszName, const char *pszDesc, void *pvUser);
typedef struct DBGFSYMBOL
} DBGFSYMBOL;
typedef struct DBGFLINE
} DBGFLINE;
VMMR3DECL(int) DBGFR3AsLoadImage(PVM pVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
VMMR3DECL(int) DBGFR3AsLoadMap(PVM pVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags);
VMMR3DECL(int) DBGFR3AsLinkModule(PVM pVM, RTDBGAS hDbgAs, RTDBGMOD hMod, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
VMMR3DECL(int) DBGFR3ModuleLoad(PVM pVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage);
VMMR3DECL(void) DBGFR3ModuleRelocate(PVM pVM, RTGCUINTPTR OldImageBase, RTGCUINTPTR NewImageBase, RTGCUINTPTR cbImage,
VMMR3DECL(int) DBGFR3SymbolAdd(PVM pVM, RTGCUINTPTR ModuleAddress, RTGCUINTPTR SymbolAddress, RTUINT cbSymbol, const char *pszSymbol);
VMMR3DECL(int) DBGFR3SymbolByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFSYMBOL pSymbol);
VMMR3DECL(PDBGFSYMBOL) DBGFR3SymbolByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
VMMR3DECL(int) DBGFR3LineByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine);
VMMR3DECL(PDBGFLINE) DBGFR3LineByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
typedef enum DBGFRETRUNTYPE
switch (enmRetType)
case DBGFRETURNTYPE_IRET64:
typedef struct DBGFSTACKFRAME
} Args;
typedef enum DBGFCODETYPE
DBGFCODETYPE_INVALID = 0,
} DBGFCODETYPE;
VMMR3DECL(int) DBGFR3StackWalkBegin(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame);
VMMR3DECL(int) DBGFR3StackWalkBeginEx(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFADDRESS pAddrFrame,
VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, unsigned fFlags, char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr);
#ifdef LOG_ENABLED
if (LogIsEnabled()) \
#ifdef LOG_ENABLED
if (LogIsEnabled()) \
VMMR3DECL(int) DBGFR3MemScan(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, const uint8_t *pabNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress);
VMMR3DECL(int) DBGFR3MemRead(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead);
VMMR3DECL(int) DBGFR3MemReadString(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cbBuf);
VMMR3DECL(int) DBGFR3MemWrite(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void const *pvBuf, size_t cbRead);
VMMR3DECL(int) DBGFR3SelQueryInfo(PVM pVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo);
typedef enum DBGFOSINTERFACE
typedef struct DBGFOSREG
DECLCALLBACKMEMBER(int, pfnQueryVersion)(PVM pVM, void *pvData, char *pszVersion, size_t cchVersion);
} DBGFOSREG;
VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion);