VirtualBox

Changeset 87776 in vbox for trunk


Ignore:
Timestamp:
Feb 17, 2021 12:21:16 PM (4 years ago)
Author:
vboxsync
Message:

dbgf.h,VMM/DBGF: A bit of cleanup on the public breakpoint structure and associated helpers, add new flags to indicate whether the breakpoint should hit before or after the instruction was executed, bugref:9837

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/dbgf.h

    r87595 r87776  
    874874     * debugger). */
    875875    DBGFBPOWNER     hOwner;
    876     /** Breakpoint type and flags, see DBGFBPTYPE for type and DBGF_BP_F_XXX for flags.
    877      * Needs to be smashed together to be able to stay in the size limits. */
    878     uint32_t        fFlagsAndType;
     876    /** Breakpoint type stored as a 16bit integer to stay within size limits. */
     877    uint16_t        u16Type;
     878    /** Breakpoint flags. */
     879    uint16_t        fFlags;
    879880
    880881    /** Union of type specific data. */
     
    943944typedef const DBGFBPPUB *PCDBGFBPPUB;
    944945
    945 /** Sets the DBGFPUB::fFlagsAndType member.
    946  * @todo r=bird: Rename to DBGF_BP_PUB_MAKE_FLAGS_AND_TYPE, as this macro
    947  *       isn't setting anything. */
    948 #define DBGF_BP_PUB_SET_FLAGS_AND_TYPE(a_enmType, a_fFlags) ((uint32_t)(a_enmType) | (a_fFlags))
    949 /** Returns the type of the DBGFPUB::fFlagsAndType member. */
    950 #define DBGF_BP_PUB_GET_TYPE(a_fFlagsAndType)               ((DBGFBPTYPE)((a_fFlagsAndType) & (UINT32_C(0x7fffffff))))
    951 /** Returns the enabled status of DBGFPUB::fFlagsAndType member. */
    952 #define DBGF_BP_PUB_IS_ENABLED(a_fFlagsAndType)             RT_BOOL((a_fFlagsAndType) & DBGF_BP_F_ENABLED)
    953 
    954 /** @name Possible DBGFBPPUB::fFlagsAndType flags.
     946/** Sets the DBGFPUB::u16Type member. */
     947#define DBGF_BP_PUB_MAKE_TYPE(a_enmType)          ((uint16_t)(a_enmType))
     948/** Returns the type of the DBGFPUB::u16Type member. */
     949#define DBGF_BP_PUB_GET_TYPE(a_pBp)               ((DBGFBPTYPE)((a_pBp)->u16Type))
     950/** Returns the enabled status of DBGFPUB::fFlags member. */
     951#define DBGF_BP_PUB_IS_ENABLED(a_pBp)             RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_ENABLED)
     952/** Returns whether DBGF_BP_F_HIT_EXEC_BEFORE is set for DBGFPUB::fFlags. */
     953#define DBGF_BP_PUB_IS_EXEC_BEFORE(a_pBp)         RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_HIT_EXEC_BEFORE)
     954/** Returns whether DBGF_BP_F_HIT_EXEC_AFTER is set for DBGFPUB::fFlags. */
     955#define DBGF_BP_PUB_IS_EXEC_AFTER(a_pBp)          RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_HIT_EXEC_AFTER)
     956
     957
     958/** @name Possible DBGFBPPUB::fFlags flags.
    955959 * @{ */
    956 /** Default flags. */
    957 #define DBGF_BP_F_DEFAULT                   0
     960/** Default flags, breakpoint is enabled and hits before the instruction is executed. */
     961#define DBGF_BP_F_DEFAULT                   (DBGF_BP_F_ENABLED | DBGF_BP_F_HIT_EXEC_BEFORE)
    958962/** Flag whether the breakpoint is enabled currently. */
    959 #define DBGF_BP_F_ENABLED                   RT_BIT_32(31)
     963#define DBGF_BP_F_ENABLED                   RT_BIT(0)
     964/** Flag indicating whether the action assoicated with the breakpoint should be carried out
     965 * before the instruction causing the breakpoint to hit was executed. */
     966#define DBGF_BP_F_HIT_EXEC_BEFORE           RT_BIT(1)
     967/** Flag indicating whether the action assoicated with the breakpoint should be carried out
     968 * after the instruction causing the breakpoint to hit was executed. */
     969#define DBGF_BP_F_HIT_EXEC_AFTER            RT_BIT(2)
    960970/** @} */
    961971
     
    974984 * @param   hBp         The breakpoint handle.
    975985 * @param   pBpPub      Pointer to the readonly public state of the breakpoint.
     986 * @param   fFlags      Flags indicating when the handler was called (DBGF_BP_F_HIT_EXEC_BEFORE vs DBGF_BP_F_HIT_EXEC_AFTER).
    976987 *
    977988 * @remarks The handler is called on the EMT of vCPU triggering the breakpoint and no locks are held.
     
    979990 *          guru meditation.
    980991 */
    981 typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNDBGFBPHIT,(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub));
     992typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNDBGFBPHIT,(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub,
     993                                                    uint16_t fFlags));
    982994/** Pointer to a FNDBGFBPHIT(). */
    983995typedef FNDBGFBPHIT *PFNDBGFBPHIT;
     
    9931005                               uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
    9941006VMMR3DECL(int) DBGFR3BpSetInt3Ex(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
    995                                  VMCPUID idSrcCpu, PCDBGFADDRESS pAddress,
     1007                                 VMCPUID idSrcCpu, PCDBGFADDRESS pAddress, uint16_t fFlags,
    9961008                                 uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
    9971009VMMR3DECL(int) DBGFR3BpSetReg(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger,
    9981010                              uint64_t iHitDisable, uint8_t fType, uint8_t cb, PDBGFBP phBp);
    9991011VMMR3DECL(int) DBGFR3BpSetRegEx(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
    1000                                 PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
     1012                                PCDBGFADDRESS pAddress, uint16_t fFlags,
     1013                                uint64_t iHitTrigger, uint64_t iHitDisable,
    10011014                                uint8_t fType, uint8_t cb, PDBGFBP phBp);
    10021015VMMR3DECL(int) DBGFR3BpSetREM(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger,
  • trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp

    r87594 r87776  
    962962     * BP type and size.
    963963     */
    964     DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "%#4x %c ", hBp, DBGF_BP_PUB_IS_ENABLED(pBp->fFlagsAndType) ? 'e' : 'd');
     964    DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "%#4x %c ", hBp, DBGF_BP_PUB_IS_ENABLED(pBp) ? 'e' : 'd');
    965965    bool fHasAddress = false;
    966     switch (DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType))
     966    switch (DBGF_BP_PUB_GET_TYPE(pBp))
    967967    {
    968968        case DBGFBPTYPE_INT3:
     
    991991        case DBGFBPTYPE_MMIO:
    992992        {
    993             uint32_t fAccess = DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType) == DBGFBPTYPE_PORT_IO ? pBp->u.PortIo.fAccess : pBp->u.Mmio.fAccess;
    994             DBGCCmdHlpPrintf(&pDbgc->CmdHlp, DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType) == DBGFBPTYPE_PORT_IO ?  " i" : " m");
     993            uint32_t fAccess = DBGF_BP_PUB_GET_TYPE(pBp) == DBGFBPTYPE_PORT_IO ? pBp->u.PortIo.fAccess : pBp->u.Mmio.fAccess;
     994            DBGCCmdHlpPrintf(&pDbgc->CmdHlp, DBGF_BP_PUB_GET_TYPE(pBp) == DBGFBPTYPE_PORT_IO ?  " i" : " m");
    995995            DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " %c%c%c%c%c%c",
    996996                             fAccess & DBGFBPIOACCESS_READ_MASK   ? 'r' : '-',
     
    10071007                             fAccess & DBGFBPIOACCESS_WRITE_QWORD ? '8' : '-',
    10081008                             fAccess & DBGFBPIOACCESS_WRITE_OTHER ? '+' : '-');
    1009             if (DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType) == DBGFBPTYPE_PORT_IO)
     1009            if (DBGF_BP_PUB_GET_TYPE(pBp) == DBGFBPTYPE_PORT_IO)
    10101010                DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " %04x-%04x",
    10111011                                 pBp->u.PortIo.uPort, pBp->u.PortIo.uPort + pBp->u.PortIo.cPorts - 1);
     
    10161016
    10171017        default:
    1018             DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " unknown type %d!!", DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType));
     1018            DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " unknown type %d!!", DBGF_BP_PUB_GET_TYPE(pBp));
    10191019            AssertFailed();
    10201020            break;
  • trunk/src/VBox/VMM/VMMAll/DBGFAllBp.cpp

    r87594 r87776  
    169169    if (pBpOwnerR0)
    170170    {
    171         VBOXSTRICTRC rcStrict = pBpOwnerR0->pfnBpHitR0(pVM, pVCpu->idCpu, pBpR0->pvUserR0, hBp, &pBp->Pub);
     171        VBOXSTRICTRC rcStrict = VINF_SUCCESS;
     172
     173        if (DBGF_BP_PUB_IS_EXEC_BEFORE(&pBp->Pub))
     174            rcStrict = pBpOwnerR0->pfnBpHitR0(pVM, pVCpu->idCpu, pBpR0->pvUserR0, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_BEFORE);
    172175        if (rcStrict == VINF_SUCCESS)
    173176        {
     
    181184                abInstr[0] = pBp->Pub.u.Int3.bOrg;
    182185                rcStrict = IEMExecOneWithPrefetchedByPC(pVCpu, CPUMCTX2CORE(&pVCpu->cpum.GstCtx), GCPtrInstr, &abInstr[0], sizeof(abInstr));
    183                 rc = VBOXSTRICTRC_VAL(rcStrict);
     186                if (   rcStrict == VINF_SUCCESS
     187                    && DBGF_BP_PUB_IS_EXEC_AFTER(&pBp->Pub))
     188                {
     189                    rcStrict = pBpOwnerR0->pfnBpHitR0(pVM, pVCpu->idCpu, pBpR0->pvUserR0, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_AFTER);
     190                    if (rcStrict == VINF_SUCCESS)
     191                        rc = VINF_SUCCESS;
     192                    else if (   rcStrict == VINF_DBGF_BP_HALT
     193                             || rcStrict == VINF_DBGF_R3_BP_OWNER_DEFER)
     194                    {
     195                        pVCpu->dbgf.s.hBpActive = hBp;
     196                        if (rcStrict == VINF_DBGF_R3_BP_OWNER_DEFER)
     197                            pVCpu->dbgf.s.fBpInvokeOwnerCallback = true;
     198                        else
     199                            pVCpu->dbgf.s.fBpInvokeOwnerCallback = false;
     200                    }
     201                    else /* Guru meditation. */
     202                        rc = VERR_DBGF_BP_OWNER_CALLBACK_WRONG_STATUS;
     203                }
     204                else
     205                    rc = VBOXSTRICTRC_VAL(rcStrict);
    184206            }
    185207        }
     
    249271#endif
    250272            if (   pBp
    251                 && DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3)
     273                && DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3)
    252274#ifdef IN_RING3
    253275                return dbgfBpHit(pVM, pVCpu, pRegFrame, hBp, pBp);
     
    379401#endif
    380402                if (   pBp
    381                     && DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3)
     403                    && DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3)
    382404                {
    383405                    if (pBp->Pub.u.Int3.GCPtr == (RTGCUINTPTR)GCPtrBp)
  • trunk/src/VBox/VMM/VMMR3/DBGFR3Bp.cpp

    r87597 r87776  
    568568 * @param   pvUser              Opaque user data passed in the owner callback.
    569569 * @param   enmType             Breakpoint type to allocate.
     570 * @param   fFlags              Flags assoicated with the allocated breakpoint.
    570571 * @param   iHitTrigger         The hit count at which the breakpoint start triggering.
    571572 *                              Use 0 (or 1) if it's gonna trigger at once.
     
    578579 */
    579580static int dbgfR3BpAlloc(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser, DBGFBPTYPE enmType,
    580                          uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp,
     581                         uint16_t fFlags, uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp,
    581582                         PDBGFBPINT *ppBp)
    582583{
     
    637638                        pBp->Pub.iHitDisable   = iHitDisable;
    638639                        pBp->Pub.hOwner        = hOwner;
    639                         pBp->Pub.fFlagsAndType = DBGF_BP_PUB_SET_FLAGS_AND_TYPE(enmType, DBGF_BP_F_DEFAULT);
     640                        pBp->Pub.u16Type       = DBGF_BP_PUB_MAKE_TYPE(enmType);
     641                        pBp->Pub.fFlags        = fFlags & ~DBGF_BP_F_ENABLED; /* The enabled flag is handled in the respective APIs. */
    640642                        pBp->pvUserR3          = pvUser;
    641643
     
    881883DECLINLINE(void) dbgfR3BpSetEnabled(PDBGFBPINT pBp, bool fEnabled)
    882884{
    883     DBGFBPTYPE enmType = DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType);
    884885    if (fEnabled)
    885         pBp->Pub.fFlagsAndType = DBGF_BP_PUB_SET_FLAGS_AND_TYPE(enmType, DBGF_BP_F_ENABLED);
     886        pBp->Pub.fFlags |= DBGF_BP_F_ENABLED;
    886887    else
    887         pBp->Pub.fFlagsAndType = DBGF_BP_PUB_SET_FLAGS_AND_TYPE(enmType, 0 /*fFlags*/);
     888        pBp->Pub.fFlags &= ~DBGF_BP_F_ENABLED;
    888889}
    889890
     
    913914            pHwBp->fType    = pBp->Pub.u.Reg.fType;
    914915            pHwBp->cb       = pBp->Pub.u.Reg.cb;
    915             pHwBp->fEnabled = DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType);
     916            pHwBp->fEnabled = DBGF_BP_PUB_IS_ENABLED(&pBp->Pub);
    916917
    917918            pBp->Pub.u.Reg.iReg = i;
     
    13211322static int dbgfR3BpInt3Add(PUVM pUVM, DBGFBP hBp, PDBGFBPINT pBp)
    13221323{
    1323     AssertReturn(DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
     1324    AssertReturn(DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
    13241325
    13251326    int rc = VINF_SUCCESS;
     
    15091510static int dbgfR3BpInt3Remove(PUVM pUVM, DBGFBP hBp, PDBGFBPINT pBp)
    15101511{
    1511     AssertReturn(DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
     1512    AssertReturn(DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
    15121513
    15131514    /*
     
    15631564    PVM pVM = pUVM->pVM;
    15641565
    1565     Assert(!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType));
    1566     switch (DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType))
     1566    Assert(!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub));
     1567    switch (DBGF_BP_PUB_GET_TYPE(&pBp->Pub))
    15671568    {
    15681569        case DBGFBPTYPE_REG:
     
    16141615            break;
    16151616        default:
    1616             AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType)),
     1617            AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(&pBp->Pub)),
    16171618                                  VERR_IPE_NOT_REACHED_DEFAULT_CASE);
    16181619    }
     
    16371638    PVM pVM = pUVM->pVM;
    16381639
    1639     Assert(DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType));
    1640     switch (DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType))
     1640    Assert(DBGF_BP_PUB_IS_ENABLED(&pBp->Pub));
     1641    switch (DBGF_BP_PUB_GET_TYPE(&pBp->Pub))
    16411642    {
    16421643        case DBGFBPTYPE_REG:
     
    16821683            break;
    16831684        default:
    1684             AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType)),
     1685            AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(&pBp->Pub)),
    16851686                                  VERR_IPE_NOT_REACHED_DEFAULT_CASE);
    16861687    }
     
    18051806{
    18061807    return DBGFR3BpSetInt3Ex(pUVM, NIL_DBGFBPOWNER, NULL /*pvUser*/, idSrcCpu, pAddress,
    1807                              iHitTrigger, iHitDisable, phBp);
     1808                             DBGF_BP_F_DEFAULT, iHitTrigger, iHitDisable, phBp);
    18081809}
    18091810
     
    18191820 *                          breakpoint address resolution.
    18201821 * @param   pAddress        The address of the breakpoint.
     1822 * @param   fFlags          Combination of DBGF_BP_F_XXX.
    18211823 * @param   iHitTrigger     The hit count at which the breakpoint start triggering.
    18221824 *                          Use 0 (or 1) if it's gonna trigger at once.
     
    18281830 */
    18291831VMMR3DECL(int) DBGFR3BpSetInt3Ex(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
    1830                                  VMCPUID idSrcCpu, PCDBGFADDRESS pAddress,
     1832                                 VMCPUID idSrcCpu, PCDBGFADDRESS pAddress, uint16_t fFlags,
    18311833                                 uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp)
    18321834{
     
    18591861        {
    18601862            rc = VINF_SUCCESS;
    1861             if (!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
     1863            if (!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
    18621864                rc = dbgfR3BpArm(pUVM, hBp, pBp);
    18631865            if (RT_SUCCESS(rc))
     
    18701872        }
    18711873
    1872         rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_INT3, iHitTrigger, iHitDisable, &hBp, &pBp);
     1874        rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_INT3, fFlags, iHitTrigger, iHitDisable, &hBp, &pBp);
    18731875        if (RT_SUCCESS(rc))
    18741876        {
     
    18801882            if (RT_SUCCESS(rc))
    18811883            {
    1882                 /* Enable the breakpoint. */
    1883                 rc = dbgfR3BpArm(pUVM, hBp, pBp);
     1884                /* Enable the breakpoint if requested. */
     1885                if (fFlags & DBGF_BP_F_ENABLED)
     1886                    rc = dbgfR3BpArm(pUVM, hBp, pBp);
    18841887                if (RT_SUCCESS(rc))
    18851888                {
     
    19201923{
    19211924    return DBGFR3BpSetRegEx(pUVM, NIL_DBGFBPOWNER, NULL /*pvUser*/, pAddress,
    1922                             iHitTrigger, iHitDisable, fType, cb, phBp);
     1925                            DBGF_BP_F_DEFAULT, iHitTrigger, iHitDisable, fType, cb, phBp);
    19231926}
    19241927
     
    19321935 * @param   pvUser          Opaque user data to pass in the owner callback.
    19331936 * @param   pAddress        The address of the breakpoint.
     1937 * @param   fFlags          Combination of DBGF_BP_F_XXX.
    19341938 * @param   iHitTrigger     The hit count at which the breakpoint start triggering.
    19351939 *                          Use 0 (or 1) if it's gonna trigger at once.
     
    19441948 */
    19451949VMMR3DECL(int) DBGFR3BpSetRegEx(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
    1946                                 PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
     1950                                PCDBGFADDRESS pAddress,  uint16_t fFlags,
     1951                                uint64_t iHitTrigger, uint64_t iHitDisable,
    19471952                                uint8_t fType, uint8_t cb, PDBGFBP phBp)
    19481953{
     
    19771982    {
    19781983        rc = VINF_SUCCESS;
    1979         if (!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
     1984        if (!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
    19801985            rc = dbgfR3BpArm(pUVM, hBp, pBp);
    19811986        if (RT_SUCCESS(rc))
     
    19891994
    19901995    /* Allocate new breakpoint. */
    1991     rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_REG, iHitTrigger, iHitDisable, &hBp, &pBp);
     1996    rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_REG, fFlags,
     1997                       iHitTrigger, iHitDisable, &hBp, &pBp);
    19921998    if (RT_SUCCESS(rc))
    19931999    {
     
    20032009        {
    20042010            /* Arm the breakpoint. */
    2005             rc = dbgfR3BpArm(pUVM, hBp, pBp);
     2011            if (fFlags & DBGF_BP_F_ENABLED)
     2012                rc = dbgfR3BpArm(pUVM, hBp, pBp);
    20062013            if (RT_SUCCESS(rc))
    20072014            {
     
    20102017                return VINF_SUCCESS;
    20112018            }
    2012             else
    2013             {
    2014                 int rc2 = dbgfR3BpRegRemove(pUVM->pVM, hBp, pBp);
    2015                 AssertRC(rc2); RT_NOREF(rc2);
    2016             }
     2019
     2020            int rc2 = dbgfR3BpRegRemove(pUVM->pVM, hBp, pBp);
     2021            AssertRC(rc2); RT_NOREF(rc2);
    20172022        }
    20182023
     
    21832188
    21842189    /* Disarm the breakpoint when it is enabled. */
    2185     if (DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
     2190    if (DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
    21862191    {
    21872192        int rc = dbgfR3BpDisarm(pUVM, hBp, pBp);
     
    21892194    }
    21902195
    2191     switch (DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType))
     2196    switch (DBGF_BP_PUB_GET_TYPE(&pBp->Pub))
    21922197    {
    21932198        case DBGFBPTYPE_REG:
     
    22272232
    22282233    int rc;
    2229     if (!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
     2234    if (!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
    22302235        rc = dbgfR3BpArm(pUVM, hBp, pBp);
    22312236    else
     
    22572262
    22582263    int rc;
    2259     if (DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
     2264    if (DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
    22602265        rc = dbgfR3BpDisarm(pUVM, hBp, pBp);
    22612266    else
     
    23042309                    BpPub.iHitDisable   = ASMAtomicReadU64((volatile uint64_t *)&pBp->Pub.iHitDisable);
    23052310                    BpPub.hOwner        = ASMAtomicReadU32((volatile uint32_t *)&pBp->Pub.hOwner);
    2306                     BpPub.fFlagsAndType = ASMAtomicReadU32((volatile uint32_t *)&pBp->Pub.fFlagsAndType);
     2311                    BpPub.u16Type       = ASMAtomicReadU16((volatile uint16_t *)&pBp->Pub.u16Type); /* Actually constant. */
     2312                    BpPub.fFlags        = ASMAtomicReadU16((volatile uint16_t *)&pBp->Pub.fFlags);
    23072313                    memcpy(&BpPub.u, &pBp->Pub.u, sizeof(pBp->Pub.u)); /* Is constant after allocation. */
    23082314
     
    23472353        if (pBpOwner)
    23482354        {
    2349             VBOXSTRICTRC rcStrict = pBpOwner->pfnBpHitR3(pVM, pVCpu->idCpu, pBp->pvUserR3, hBp, &pBp->Pub);
     2355            VBOXSTRICTRC rcStrict = VINF_SUCCESS;
     2356
     2357            if (DBGF_BP_PUB_IS_EXEC_BEFORE(&pBp->Pub))
     2358                rcStrict = pBpOwner->pfnBpHitR3(pVM, pVCpu->idCpu, pBp->pvUserR3, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_BEFORE);
    23502359            if (rcStrict == VINF_SUCCESS)
    23512360            {
     
    23592368                    abInstr[0] = pBp->Pub.u.Int3.bOrg;
    23602369                    rcStrict = IEMExecOneWithPrefetchedByPC(pVCpu, CPUMCTX2CORE(&pVCpu->cpum.GstCtx), GCPtrInstr, &abInstr[0], sizeof(abInstr));
    2361                     return VBOXSTRICTRC_VAL(rcStrict);
     2370                    if (   rcStrict == VINF_SUCCESS
     2371                        && DBGF_BP_PUB_IS_EXEC_AFTER(&pBp->Pub))
     2372                    {
     2373                        VBOXSTRICTRC rcStrict2 = pBpOwner->pfnBpHitR3(pVM, pVCpu->idCpu, pBp->pvUserR3, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_AFTER);
     2374                        if (rcStrict2 == VINF_SUCCESS)
     2375                            return VBOXSTRICTRC_VAL(rcStrict);
     2376                        else if (rcStrict2 != VINF_DBGF_BP_HALT)
     2377                            return VERR_DBGF_BP_OWNER_CALLBACK_WRONG_STATUS;
     2378                    }
     2379                    else
     2380                        return VBOXSTRICTRC_VAL(rcStrict);
    23622381                }
    23632382            }
  • trunk/src/VBox/VMM/VMMR3/DBGFR3FlowTrace.cpp

    r87577 r87776  
    765765 * @callback_method_impl{FNDBGFBPHIT}
    766766 */
    767 static DECLCALLBACK(VBOXSTRICTRC) dbgfR3FlowTraceModProbeFiredWorker(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub)
    768 {
    769     RT_NOREF(pVM, hBp, pBpPub);
     767static DECLCALLBACK(VBOXSTRICTRC) dbgfR3FlowTraceModProbeFiredWorker(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub, uint16_t fFlags)
     768{
     769    RT_NOREF(pVM, hBp, pBpPub, fFlags);
    770770    LogFlowFunc(("pVM=%#p idCpu=%u pvUserBp=%#p hBp=%#x pBpPub=%p\n",
    771771                 pVM, idCpu, pvUserBp, hBp, pBpPub));
     
    857857    {
    858858        rc = DBGFR3BpSetInt3Ex(pThis->pUVM, pThis->hBpOwner, pProbeLoc,
    859                                0 /*idSrcCpu*/, &pProbeLoc->AddrProbe,
     859                               0 /*idSrcCpu*/, &pProbeLoc->AddrProbe, DBGF_BP_F_DEFAULT,
    860860                               0 /*iHitTrigger*/, ~0ULL /*iHitDisable*/, &pProbeLoc->hBp);
    861861        if (RT_FAILURE(rc))
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette