Index: /trunk/include/VBox/vmm/dbgf.h
===================================================================
--- /trunk/include/VBox/vmm/dbgf.h	(revision 87775)
+++ /trunk/include/VBox/vmm/dbgf.h	(revision 87776)
@@ -874,7 +874,8 @@
      * debugger). */
     DBGFBPOWNER     hOwner;
-    /** Breakpoint type and flags, see DBGFBPTYPE for type and DBGF_BP_F_XXX for flags.
-     * Needs to be smashed together to be able to stay in the size limits. */
-    uint32_t        fFlagsAndType;
+    /** Breakpoint type stored as a 16bit integer to stay within size limits. */
+    uint16_t        u16Type;
+    /** Breakpoint flags. */
+    uint16_t        fFlags;
 
     /** Union of type specific data. */
@@ -943,19 +944,28 @@
 typedef const DBGFBPPUB *PCDBGFBPPUB;
 
-/** Sets the DBGFPUB::fFlagsAndType member.
- * @todo r=bird: Rename to DBGF_BP_PUB_MAKE_FLAGS_AND_TYPE, as this macro
- *       isn't setting anything. */
-#define DBGF_BP_PUB_SET_FLAGS_AND_TYPE(a_enmType, a_fFlags) ((uint32_t)(a_enmType) | (a_fFlags))
-/** Returns the type of the DBGFPUB::fFlagsAndType member. */
-#define DBGF_BP_PUB_GET_TYPE(a_fFlagsAndType)               ((DBGFBPTYPE)((a_fFlagsAndType) & (UINT32_C(0x7fffffff))))
-/** Returns the enabled status of DBGFPUB::fFlagsAndType member. */
-#define DBGF_BP_PUB_IS_ENABLED(a_fFlagsAndType)             RT_BOOL((a_fFlagsAndType) & DBGF_BP_F_ENABLED)
-
-/** @name Possible DBGFBPPUB::fFlagsAndType flags.
+/** Sets the DBGFPUB::u16Type member. */
+#define DBGF_BP_PUB_MAKE_TYPE(a_enmType)          ((uint16_t)(a_enmType))
+/** Returns the type of the DBGFPUB::u16Type member. */
+#define DBGF_BP_PUB_GET_TYPE(a_pBp)               ((DBGFBPTYPE)((a_pBp)->u16Type))
+/** Returns the enabled status of DBGFPUB::fFlags member. */
+#define DBGF_BP_PUB_IS_ENABLED(a_pBp)             RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_ENABLED)
+/** Returns whether DBGF_BP_F_HIT_EXEC_BEFORE is set for DBGFPUB::fFlags. */
+#define DBGF_BP_PUB_IS_EXEC_BEFORE(a_pBp)         RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_HIT_EXEC_BEFORE)
+/** Returns whether DBGF_BP_F_HIT_EXEC_AFTER is set for DBGFPUB::fFlags. */
+#define DBGF_BP_PUB_IS_EXEC_AFTER(a_pBp)          RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_HIT_EXEC_AFTER)
+
+
+/** @name Possible DBGFBPPUB::fFlags flags.
  * @{ */
-/** Default flags. */
-#define DBGF_BP_F_DEFAULT                   0
+/** Default flags, breakpoint is enabled and hits before the instruction is executed. */
+#define DBGF_BP_F_DEFAULT                   (DBGF_BP_F_ENABLED | DBGF_BP_F_HIT_EXEC_BEFORE)
 /** Flag whether the breakpoint is enabled currently. */
-#define DBGF_BP_F_ENABLED                   RT_BIT_32(31)
+#define DBGF_BP_F_ENABLED                   RT_BIT(0)
+/** Flag indicating whether the action assoicated with the breakpoint should be carried out
+ * before the instruction causing the breakpoint to hit was executed. */
+#define DBGF_BP_F_HIT_EXEC_BEFORE           RT_BIT(1)
+/** Flag indicating whether the action assoicated with the breakpoint should be carried out
+ * after the instruction causing the breakpoint to hit was executed. */
+#define DBGF_BP_F_HIT_EXEC_AFTER            RT_BIT(2)
 /** @} */
 
@@ -974,4 +984,5 @@
  * @param   hBp         The breakpoint handle.
  * @param   pBpPub      Pointer to the readonly public state of the breakpoint.
+ * @param   fFlags      Flags indicating when the handler was called (DBGF_BP_F_HIT_EXEC_BEFORE vs DBGF_BP_F_HIT_EXEC_AFTER).
  *
  * @remarks The handler is called on the EMT of vCPU triggering the breakpoint and no locks are held.
@@ -979,5 +990,6 @@
  *          guru meditation.
  */
-typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNDBGFBPHIT,(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub));
+typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNDBGFBPHIT,(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub,
+                                                    uint16_t fFlags));
 /** Pointer to a FNDBGFBPHIT(). */
 typedef FNDBGFBPHIT *PFNDBGFBPHIT;
@@ -993,10 +1005,11 @@
                                uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
 VMMR3DECL(int) DBGFR3BpSetInt3Ex(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
-                                 VMCPUID idSrcCpu, PCDBGFADDRESS pAddress,
+                                 VMCPUID idSrcCpu, PCDBGFADDRESS pAddress, uint16_t fFlags,
                                  uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
 VMMR3DECL(int) DBGFR3BpSetReg(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger,
                               uint64_t iHitDisable, uint8_t fType, uint8_t cb, PDBGFBP phBp);
 VMMR3DECL(int) DBGFR3BpSetRegEx(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
-                                PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
+                                PCDBGFADDRESS pAddress, uint16_t fFlags,
+                                uint64_t iHitTrigger, uint64_t iHitDisable,
                                 uint8_t fType, uint8_t cb, PDBGFBP phBp);
 VMMR3DECL(int) DBGFR3BpSetREM(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger,
Index: /trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
===================================================================
--- /trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp	(revision 87775)
+++ /trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp	(revision 87776)
@@ -962,7 +962,7 @@
      * BP type and size.
      */
-    DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "%#4x %c ", hBp, DBGF_BP_PUB_IS_ENABLED(pBp->fFlagsAndType) ? 'e' : 'd');
+    DBGCCmdHlpPrintf(&pDbgc->CmdHlp, "%#4x %c ", hBp, DBGF_BP_PUB_IS_ENABLED(pBp) ? 'e' : 'd');
     bool fHasAddress = false;
-    switch (DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType))
+    switch (DBGF_BP_PUB_GET_TYPE(pBp))
     {
         case DBGFBPTYPE_INT3:
@@ -991,6 +991,6 @@
         case DBGFBPTYPE_MMIO:
         {
-            uint32_t fAccess = DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType) == DBGFBPTYPE_PORT_IO ? pBp->u.PortIo.fAccess : pBp->u.Mmio.fAccess;
-            DBGCCmdHlpPrintf(&pDbgc->CmdHlp, DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType) == DBGFBPTYPE_PORT_IO ?  " i" : " m");
+            uint32_t fAccess = DBGF_BP_PUB_GET_TYPE(pBp) == DBGFBPTYPE_PORT_IO ? pBp->u.PortIo.fAccess : pBp->u.Mmio.fAccess;
+            DBGCCmdHlpPrintf(&pDbgc->CmdHlp, DBGF_BP_PUB_GET_TYPE(pBp) == DBGFBPTYPE_PORT_IO ?  " i" : " m");
             DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " %c%c%c%c%c%c",
                              fAccess & DBGFBPIOACCESS_READ_MASK   ? 'r' : '-',
@@ -1007,5 +1007,5 @@
                              fAccess & DBGFBPIOACCESS_WRITE_QWORD ? '8' : '-',
                              fAccess & DBGFBPIOACCESS_WRITE_OTHER ? '+' : '-');
-            if (DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType) == DBGFBPTYPE_PORT_IO)
+            if (DBGF_BP_PUB_GET_TYPE(pBp) == DBGFBPTYPE_PORT_IO)
                 DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " %04x-%04x",
                                  pBp->u.PortIo.uPort, pBp->u.PortIo.uPort + pBp->u.PortIo.cPorts - 1);
@@ -1016,5 +1016,5 @@
 
         default:
-            DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " unknown type %d!!", DBGF_BP_PUB_GET_TYPE(pBp->fFlagsAndType));
+            DBGCCmdHlpPrintf(&pDbgc->CmdHlp, " unknown type %d!!", DBGF_BP_PUB_GET_TYPE(pBp));
             AssertFailed();
             break;
Index: /trunk/src/VBox/VMM/VMMAll/DBGFAllBp.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/DBGFAllBp.cpp	(revision 87775)
+++ /trunk/src/VBox/VMM/VMMAll/DBGFAllBp.cpp	(revision 87776)
@@ -169,5 +169,8 @@
     if (pBpOwnerR0)
     {
-        VBOXSTRICTRC rcStrict = pBpOwnerR0->pfnBpHitR0(pVM, pVCpu->idCpu, pBpR0->pvUserR0, hBp, &pBp->Pub);
+        VBOXSTRICTRC rcStrict = VINF_SUCCESS;
+
+        if (DBGF_BP_PUB_IS_EXEC_BEFORE(&pBp->Pub))
+            rcStrict = pBpOwnerR0->pfnBpHitR0(pVM, pVCpu->idCpu, pBpR0->pvUserR0, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_BEFORE);
         if (rcStrict == VINF_SUCCESS)
         {
@@ -181,5 +184,24 @@
                 abInstr[0] = pBp->Pub.u.Int3.bOrg;
                 rcStrict = IEMExecOneWithPrefetchedByPC(pVCpu, CPUMCTX2CORE(&pVCpu->cpum.GstCtx), GCPtrInstr, &abInstr[0], sizeof(abInstr));
-                rc = VBOXSTRICTRC_VAL(rcStrict);
+                if (   rcStrict == VINF_SUCCESS
+                    && DBGF_BP_PUB_IS_EXEC_AFTER(&pBp->Pub))
+                {
+                    rcStrict = pBpOwnerR0->pfnBpHitR0(pVM, pVCpu->idCpu, pBpR0->pvUserR0, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_AFTER);
+                    if (rcStrict == VINF_SUCCESS)
+                        rc = VINF_SUCCESS;
+                    else if (   rcStrict == VINF_DBGF_BP_HALT
+                             || rcStrict == VINF_DBGF_R3_BP_OWNER_DEFER)
+                    {
+                        pVCpu->dbgf.s.hBpActive = hBp;
+                        if (rcStrict == VINF_DBGF_R3_BP_OWNER_DEFER)
+                            pVCpu->dbgf.s.fBpInvokeOwnerCallback = true;
+                        else
+                            pVCpu->dbgf.s.fBpInvokeOwnerCallback = false;
+                    }
+                    else /* Guru meditation. */
+                        rc = VERR_DBGF_BP_OWNER_CALLBACK_WRONG_STATUS;
+                }
+                else
+                    rc = VBOXSTRICTRC_VAL(rcStrict);
             }
         }
@@ -249,5 +271,5 @@
 #endif
             if (   pBp
-                && DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3)
+                && DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3)
 #ifdef IN_RING3
                 return dbgfBpHit(pVM, pVCpu, pRegFrame, hBp, pBp);
@@ -379,5 +401,5 @@
 #endif
                 if (   pBp
-                    && DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3)
+                    && DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3)
                 {
                     if (pBp->Pub.u.Int3.GCPtr == (RTGCUINTPTR)GCPtrBp)
Index: /trunk/src/VBox/VMM/VMMR3/DBGFR3Bp.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/DBGFR3Bp.cpp	(revision 87775)
+++ /trunk/src/VBox/VMM/VMMR3/DBGFR3Bp.cpp	(revision 87776)
@@ -568,4 +568,5 @@
  * @param   pvUser              Opaque user data passed in the owner callback.
  * @param   enmType             Breakpoint type to allocate.
+ * @param   fFlags              Flags assoicated with the allocated breakpoint.
  * @param   iHitTrigger         The hit count at which the breakpoint start triggering.
  *                              Use 0 (or 1) if it's gonna trigger at once.
@@ -578,5 +579,5 @@
  */
 static int dbgfR3BpAlloc(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser, DBGFBPTYPE enmType,
-                         uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp,
+                         uint16_t fFlags, uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp,
                          PDBGFBPINT *ppBp)
 {
@@ -637,5 +638,6 @@
                         pBp->Pub.iHitDisable   = iHitDisable;
                         pBp->Pub.hOwner        = hOwner;
-                        pBp->Pub.fFlagsAndType = DBGF_BP_PUB_SET_FLAGS_AND_TYPE(enmType, DBGF_BP_F_DEFAULT);
+                        pBp->Pub.u16Type       = DBGF_BP_PUB_MAKE_TYPE(enmType);
+                        pBp->Pub.fFlags        = fFlags & ~DBGF_BP_F_ENABLED; /* The enabled flag is handled in the respective APIs. */
                         pBp->pvUserR3          = pvUser;
 
@@ -881,9 +883,8 @@
 DECLINLINE(void) dbgfR3BpSetEnabled(PDBGFBPINT pBp, bool fEnabled)
 {
-    DBGFBPTYPE enmType = DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType);
     if (fEnabled)
-        pBp->Pub.fFlagsAndType = DBGF_BP_PUB_SET_FLAGS_AND_TYPE(enmType, DBGF_BP_F_ENABLED);
+        pBp->Pub.fFlags |= DBGF_BP_F_ENABLED;
     else
-        pBp->Pub.fFlagsAndType = DBGF_BP_PUB_SET_FLAGS_AND_TYPE(enmType, 0 /*fFlags*/);
+        pBp->Pub.fFlags &= ~DBGF_BP_F_ENABLED;
 }
 
@@ -913,5 +914,5 @@
             pHwBp->fType    = pBp->Pub.u.Reg.fType;
             pHwBp->cb       = pBp->Pub.u.Reg.cb;
-            pHwBp->fEnabled = DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType);
+            pHwBp->fEnabled = DBGF_BP_PUB_IS_ENABLED(&pBp->Pub);
 
             pBp->Pub.u.Reg.iReg = i;
@@ -1321,5 +1322,5 @@
 static int dbgfR3BpInt3Add(PUVM pUVM, DBGFBP hBp, PDBGFBPINT pBp)
 {
-    AssertReturn(DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
+    AssertReturn(DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
 
     int rc = VINF_SUCCESS;
@@ -1509,5 +1510,5 @@
 static int dbgfR3BpInt3Remove(PUVM pUVM, DBGFBP hBp, PDBGFBPINT pBp)
 {
-    AssertReturn(DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
+    AssertReturn(DBGF_BP_PUB_GET_TYPE(&pBp->Pub) == DBGFBPTYPE_INT3, VERR_DBGF_BP_IPE_3);
 
     /*
@@ -1563,6 +1564,6 @@
     PVM pVM = pUVM->pVM;
 
-    Assert(!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType));
-    switch (DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType))
+    Assert(!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub));
+    switch (DBGF_BP_PUB_GET_TYPE(&pBp->Pub))
     {
         case DBGFBPTYPE_REG:
@@ -1614,5 +1615,5 @@
             break;
         default:
-            AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType)),
+            AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(&pBp->Pub)),
                                   VERR_IPE_NOT_REACHED_DEFAULT_CASE);
     }
@@ -1637,6 +1638,6 @@
     PVM pVM = pUVM->pVM;
 
-    Assert(DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType));
-    switch (DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType))
+    Assert(DBGF_BP_PUB_IS_ENABLED(&pBp->Pub));
+    switch (DBGF_BP_PUB_GET_TYPE(&pBp->Pub))
     {
         case DBGFBPTYPE_REG:
@@ -1682,5 +1683,5 @@
             break;
         default:
-            AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType)),
+            AssertMsgFailedReturn(("Invalid breakpoint type %d\n", DBGF_BP_PUB_GET_TYPE(&pBp->Pub)),
                                   VERR_IPE_NOT_REACHED_DEFAULT_CASE);
     }
@@ -1805,5 +1806,5 @@
 {
     return DBGFR3BpSetInt3Ex(pUVM, NIL_DBGFBPOWNER, NULL /*pvUser*/, idSrcCpu, pAddress,
-                             iHitTrigger, iHitDisable, phBp);
+                             DBGF_BP_F_DEFAULT, iHitTrigger, iHitDisable, phBp);
 }
 
@@ -1819,4 +1820,5 @@
  *                          breakpoint address resolution.
  * @param   pAddress        The address of the breakpoint.
+ * @param   fFlags          Combination of DBGF_BP_F_XXX.
  * @param   iHitTrigger     The hit count at which the breakpoint start triggering.
  *                          Use 0 (or 1) if it's gonna trigger at once.
@@ -1828,5 +1830,5 @@
  */
 VMMR3DECL(int) DBGFR3BpSetInt3Ex(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
-                                 VMCPUID idSrcCpu, PCDBGFADDRESS pAddress,
+                                 VMCPUID idSrcCpu, PCDBGFADDRESS pAddress, uint16_t fFlags,
                                  uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp)
 {
@@ -1859,5 +1861,5 @@
         {
             rc = VINF_SUCCESS;
-            if (!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
+            if (!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
                 rc = dbgfR3BpArm(pUVM, hBp, pBp);
             if (RT_SUCCESS(rc))
@@ -1870,5 +1872,5 @@
         }
 
-        rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_INT3, iHitTrigger, iHitDisable, &hBp, &pBp);
+        rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_INT3, fFlags, iHitTrigger, iHitDisable, &hBp, &pBp);
         if (RT_SUCCESS(rc))
         {
@@ -1880,6 +1882,7 @@
             if (RT_SUCCESS(rc))
             {
-                /* Enable the breakpoint. */
-                rc = dbgfR3BpArm(pUVM, hBp, pBp);
+                /* Enable the breakpoint if requested. */
+                if (fFlags & DBGF_BP_F_ENABLED)
+                    rc = dbgfR3BpArm(pUVM, hBp, pBp);
                 if (RT_SUCCESS(rc))
                 {
@@ -1920,5 +1923,5 @@
 {
     return DBGFR3BpSetRegEx(pUVM, NIL_DBGFBPOWNER, NULL /*pvUser*/, pAddress,
-                            iHitTrigger, iHitDisable, fType, cb, phBp);
+                            DBGF_BP_F_DEFAULT, iHitTrigger, iHitDisable, fType, cb, phBp);
 }
 
@@ -1932,4 +1935,5 @@
  * @param   pvUser          Opaque user data to pass in the owner callback.
  * @param   pAddress        The address of the breakpoint.
+ * @param   fFlags          Combination of DBGF_BP_F_XXX.
  * @param   iHitTrigger     The hit count at which the breakpoint start triggering.
  *                          Use 0 (or 1) if it's gonna trigger at once.
@@ -1944,5 +1948,6 @@
  */
 VMMR3DECL(int) DBGFR3BpSetRegEx(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
-                                PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
+                                PCDBGFADDRESS pAddress,  uint16_t fFlags,
+                                uint64_t iHitTrigger, uint64_t iHitDisable,
                                 uint8_t fType, uint8_t cb, PDBGFBP phBp)
 {
@@ -1977,5 +1982,5 @@
     {
         rc = VINF_SUCCESS;
-        if (!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
+        if (!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
             rc = dbgfR3BpArm(pUVM, hBp, pBp);
         if (RT_SUCCESS(rc))
@@ -1989,5 +1994,6 @@
 
     /* Allocate new breakpoint. */
-    rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_REG, iHitTrigger, iHitDisable, &hBp, &pBp);
+    rc = dbgfR3BpAlloc(pUVM, hOwner, pvUser, DBGFBPTYPE_REG, fFlags,
+                       iHitTrigger, iHitDisable, &hBp, &pBp);
     if (RT_SUCCESS(rc))
     {
@@ -2003,5 +2009,6 @@
         {
             /* Arm the breakpoint. */
-            rc = dbgfR3BpArm(pUVM, hBp, pBp);
+            if (fFlags & DBGF_BP_F_ENABLED)
+                rc = dbgfR3BpArm(pUVM, hBp, pBp);
             if (RT_SUCCESS(rc))
             {
@@ -2010,9 +2017,7 @@
                 return VINF_SUCCESS;
             }
-            else
-            {
-                int rc2 = dbgfR3BpRegRemove(pUVM->pVM, hBp, pBp);
-                AssertRC(rc2); RT_NOREF(rc2);
-            }
+
+            int rc2 = dbgfR3BpRegRemove(pUVM->pVM, hBp, pBp);
+            AssertRC(rc2); RT_NOREF(rc2);
         }
 
@@ -2183,5 +2188,5 @@
 
     /* Disarm the breakpoint when it is enabled. */
-    if (DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
+    if (DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
     {
         int rc = dbgfR3BpDisarm(pUVM, hBp, pBp);
@@ -2189,5 +2194,5 @@
     }
 
-    switch (DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType))
+    switch (DBGF_BP_PUB_GET_TYPE(&pBp->Pub))
     {
         case DBGFBPTYPE_REG:
@@ -2227,5 +2232,5 @@
 
     int rc;
-    if (!DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
+    if (!DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
         rc = dbgfR3BpArm(pUVM, hBp, pBp);
     else
@@ -2257,5 +2262,5 @@
 
     int rc;
-    if (DBGF_BP_PUB_IS_ENABLED(pBp->Pub.fFlagsAndType))
+    if (DBGF_BP_PUB_IS_ENABLED(&pBp->Pub))
         rc = dbgfR3BpDisarm(pUVM, hBp, pBp);
     else
@@ -2304,5 +2309,6 @@
                     BpPub.iHitDisable   = ASMAtomicReadU64((volatile uint64_t *)&pBp->Pub.iHitDisable);
                     BpPub.hOwner        = ASMAtomicReadU32((volatile uint32_t *)&pBp->Pub.hOwner);
-                    BpPub.fFlagsAndType = ASMAtomicReadU32((volatile uint32_t *)&pBp->Pub.fFlagsAndType);
+                    BpPub.u16Type       = ASMAtomicReadU16((volatile uint16_t *)&pBp->Pub.u16Type); /* Actually constant. */
+                    BpPub.fFlags        = ASMAtomicReadU16((volatile uint16_t *)&pBp->Pub.fFlags);
                     memcpy(&BpPub.u, &pBp->Pub.u, sizeof(pBp->Pub.u)); /* Is constant after allocation. */
 
@@ -2347,5 +2353,8 @@
         if (pBpOwner)
         {
-            VBOXSTRICTRC rcStrict = pBpOwner->pfnBpHitR3(pVM, pVCpu->idCpu, pBp->pvUserR3, hBp, &pBp->Pub);
+            VBOXSTRICTRC rcStrict = VINF_SUCCESS;
+
+            if (DBGF_BP_PUB_IS_EXEC_BEFORE(&pBp->Pub))
+                rcStrict = pBpOwner->pfnBpHitR3(pVM, pVCpu->idCpu, pBp->pvUserR3, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_BEFORE);
             if (rcStrict == VINF_SUCCESS)
             {
@@ -2359,5 +2368,15 @@
                     abInstr[0] = pBp->Pub.u.Int3.bOrg;
                     rcStrict = IEMExecOneWithPrefetchedByPC(pVCpu, CPUMCTX2CORE(&pVCpu->cpum.GstCtx), GCPtrInstr, &abInstr[0], sizeof(abInstr));
-                    return VBOXSTRICTRC_VAL(rcStrict);
+                    if (   rcStrict == VINF_SUCCESS
+                        && DBGF_BP_PUB_IS_EXEC_AFTER(&pBp->Pub))
+                    {
+                        VBOXSTRICTRC rcStrict2 = pBpOwner->pfnBpHitR3(pVM, pVCpu->idCpu, pBp->pvUserR3, hBp, &pBp->Pub, DBGF_BP_F_HIT_EXEC_AFTER);
+                        if (rcStrict2 == VINF_SUCCESS)
+                            return VBOXSTRICTRC_VAL(rcStrict);
+                        else if (rcStrict2 != VINF_DBGF_BP_HALT)
+                            return VERR_DBGF_BP_OWNER_CALLBACK_WRONG_STATUS;
+                    }
+                    else
+                        return VBOXSTRICTRC_VAL(rcStrict);
                 }
             }
Index: /trunk/src/VBox/VMM/VMMR3/DBGFR3FlowTrace.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/DBGFR3FlowTrace.cpp	(revision 87775)
+++ /trunk/src/VBox/VMM/VMMR3/DBGFR3FlowTrace.cpp	(revision 87776)
@@ -765,7 +765,7 @@
  * @callback_method_impl{FNDBGFBPHIT}
  */
-static DECLCALLBACK(VBOXSTRICTRC) dbgfR3FlowTraceModProbeFiredWorker(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub)
-{
-    RT_NOREF(pVM, hBp, pBpPub);
+static DECLCALLBACK(VBOXSTRICTRC) dbgfR3FlowTraceModProbeFiredWorker(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub, uint16_t fFlags)
+{
+    RT_NOREF(pVM, hBp, pBpPub, fFlags);
     LogFlowFunc(("pVM=%#p idCpu=%u pvUserBp=%#p hBp=%#x pBpPub=%p\n",
                  pVM, idCpu, pvUserBp, hBp, pBpPub));
@@ -857,5 +857,5 @@
     {
         rc = DBGFR3BpSetInt3Ex(pThis->pUVM, pThis->hBpOwner, pProbeLoc,
-                               0 /*idSrcCpu*/, &pProbeLoc->AddrProbe,
+                               0 /*idSrcCpu*/, &pProbeLoc->AddrProbe, DBGF_BP_F_DEFAULT,
                                0 /*iHitTrigger*/, ~0ULL /*iHitDisable*/, &pProbeLoc->hBp);
         if (RT_FAILURE(rc))
