DBGFBp.cpp revision 1c94c0a63ba68be1a7b2c640e70d7a06464e4fca
c5e2a1c98cba51b6093b8b341f83490a7b47f25etweenk * VMM DBGF - Debugger Facility, Breakpoint Management.
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * Copyright (C) 2006-2007 Sun Microsystems, Inc.
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould * This file is part of VirtualBox Open Source Edition (OSE), as
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould * available from http://www.virtualbox.org. This file is free software;
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * you can redistribute it and/or modify it under the terms of the GNU
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * General Public License (GPL) as published by the Free Software
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * Foundation, in version 2 as it comes in the "COPYING" file of the
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * Clara, CA 95054 USA or visit http://www.sun.com if you need
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński * additional information or have any questions.
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński/*******************************************************************************
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński* Header Files *
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński*******************************************************************************/
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński/*******************************************************************************
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński* Internal Functions *
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński*******************************************************************************/
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosińskistatic DECLCALLBACK(int) dbgfR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable,
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński uint8_t u8Type, uint8_t cb, PRTUINT piBp);
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gouldstatic DECLCALLBACK(int) dbgfR3BpSetInt3(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp);
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gouldstatic DECLCALLBACK(int) dbgfR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp);
return VINF_SUCCESS;
unsigned cBps;
switch (enmType)
case DBGFBPTYPE_REG:
case DBGFBPTYPE_INT3:
case DBGFBPTYPE_REM:
return NULL;
++*pcBpsCur;
return NULL;
return NULL;
case DBGFBPTYPE_FREE:
return NULL;
case DBGFBPTYPE_REG:
case DBGFBPTYPE_INT3:
case DBGFBPTYPE_REM:
return NULL;
return pBp;
unsigned cBps;
switch (enmType)
case DBGFBPTYPE_REG:
case DBGFBPTYPE_INT3:
case DBGFBPTYPE_REM:
return NULL;
return NULL;
case DBGFBPTYPE_FREE:
case DBGFBPTYPE_REG:
case DBGFBPTYPE_INT3:
case DBGFBPTYPE_REM:
DBGFR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)dbgfR3BpSetInt3, 5, pVM, pAddress, &iHitTrigger, &iHitDisable, piBp);
return rc;
static DECLCALLBACK(int) dbgfR3BpSetInt3(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp)
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
if (piBp)
*piBp = ~0;
if (pBp)
if (piBp)
return rc;
if (!pBp)
return VERR_DBGF_NO_MORE_BP_SLOTS;
if (piBp)
return rc;
return rc;
return rc;
DBGFR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)dbgfR3BpSetReg, 7, pVM, pAddress, &iHitTrigger, &iHitDisable, fType, cb, piBp);
return rc;
static DECLCALLBACK(int) dbgfR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable,
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
if (piBp)
*piBp = ~0;
switch (fType)
case X86_DR7_RW_EO:
return VERR_INVALID_PARAMETER;
case X86_DR7_RW_IO:
case X86_DR7_RW_RW:
case X86_DR7_RW_WO:
return VERR_INVALID_PARAMETER;
switch (cb)
return VERR_INVALID_PARAMETER;
if ( pBp
if (piBp)
return rc;
if (!pBp)
return VERR_DBGF_NO_MORE_BP_SLOTS;
if (piBp)
return rc;
DBGFR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)dbgfR3BpSetREM, 5, pVM, pAddress, &iHitTrigger, &iHitDisable, piBp);
return rc;
static DECLCALLBACK(int) dbgfR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t *piHitTrigger, uint64_t *piHitDisable, PRTUINT piBp)
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
if (piBp)
*piBp = ~0;
if (pBp)
if (piBp)
return rc;
if (!pBp)
return VERR_DBGF_NO_MORE_BP_SLOTS;
if (piBp)
return rc;
return rc;
if (!pBp)
return VERR_DBGF_BP_NOT_FOUND;
int rc;
case DBGFBPTYPE_REG:
case DBGFBPTYPE_INT3:
case DBGFBPTYPE_REM:
return VERR_INTERNAL_ERROR;
return VINF_SUCCESS;
return rc;
if (!pBp)
return VERR_DBGF_BP_NOT_FOUND;
return VINF_DBGF_BP_ALREADY_ENABLED;
int rc;
case DBGFBPTYPE_REG:
case DBGFBPTYPE_INT3:
case DBGFBPTYPE_REM:
return VERR_INTERNAL_ERROR;
return rc;
return rc;
if (!pBp)
return VERR_DBGF_BP_NOT_FOUND;
return VINF_DBGF_BP_ALREADY_DISABLED;
int rc;
case DBGFBPTYPE_REG:
case DBGFBPTYPE_INT3:
case DBGFBPTYPE_REM:
return VERR_INTERNAL_ERROR;
return rc;
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)dbgfR3BpEnum, 3, pVM, pfnCallback, pvUser);
return rc;
return rc;
return rc;
return VINF_SUCCESS;