/** * Register a info handler owned by an external component. * * @returns VBox status code. * @param pVM Pointer to the VM. * @param pszName The identifier of the info. * @param pszDesc The description of the info and any arguments the handler may take. * @param pfnHandler The handler function to be called to display the info. * @param pvUser User argument to be passed to the handler. */ VMMR3DECL(int) DBGFR3InfoRegisterExternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser) { LogFlow(("DBGFR3InfoRegisterExternal: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p pvUser=%p\n", pszName, pszName, pszDesc, pszDesc, pfnHandler, pvUser)); /* * Validate the specific stuff. */ if (!pfnHandler) { AssertMsgFailed(("No handler\n")); return VERR_INVALID_PARAMETER; } /* * Register */ PDBGFINFO pInfo; int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, 0, &pInfo); if (RT_SUCCESS(rc)) { pInfo->enmType = DBGFINFOTYPE_EXT; pInfo->u.Ext.pfnHandler = pfnHandler; pInfo->u.Ext.pvUser = pvUser; RTCritSectLeave(&pVM->dbgf.s.InfoCritSect); } return rc; }
/** * Register a info handler owned by a driver. * * @returns VBox status code. * @param pVM Pointer to the VM. * @param pszName The identifier of the info. * @param pszDesc The description of the info and any arguments the handler may take. * @param pfnHandler The handler function to be called to display the info. * @param pDrvIns The driver instance owning the info. */ VMMR3DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns) { LogFlow(("DBGFR3InfoRegisterDriver: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p pDrvIns=%p\n", pszName, pszName, pszDesc, pszDesc, pfnHandler, pDrvIns)); /* * Validate the specific stuff. */ if (!pfnHandler) { AssertMsgFailed(("No handler\n")); return VERR_INVALID_PARAMETER; } if (!pDrvIns) { AssertMsgFailed(("No pDrvIns\n")); return VERR_INVALID_PARAMETER; } /* * Register */ PDBGFINFO pInfo; int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, 0, &pInfo); if (RT_SUCCESS(rc)) { pInfo->enmType = DBGFINFOTYPE_DRV; pInfo->u.Drv.pfnHandler = pfnHandler; pInfo->u.Drv.pDrvIns = pDrvIns; RTCritSectLeave(&pVM->dbgf.s.InfoCritSect); } return rc; }
/** * Register a info handler owned by an internal component. * * @returns VBox status code. * @param pVM Pointer to the VM. * @param pszName The identifier of the info. * @param pszDesc The description of the info and any arguments the handler may take. * @param pfnHandler The handler function to be called to display the info. * @param fFlags Flags, see the DBGFINFO_FLAGS_*. */ VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags) { LogFlow(("DBGFR3InfoRegisterInternal: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p fFlags=%x\n", pszName, pszName, pszDesc, pszDesc, pfnHandler, fFlags)); /* * Validate the specific stuff. */ AssertPtrReturn(pfnHandler, VERR_INVALID_POINTER); /* * Register */ PDBGFINFO pInfo; int rc = dbgfR3InfoRegister(pVM->pUVM, pszName, pszDesc, fFlags, &pInfo); if (RT_SUCCESS(rc)) { pInfo->enmType = DBGFINFOTYPE_INT; pInfo->u.Int.pfnHandler = pfnHandler; RTCritSectLeave(&pVM->pUVM->dbgf.s.InfoCritSect); } return rc; }
/** * Register a info handler owned by an external component. * * @returns VBox status code. * @param pUVM The user mode VM handle. * @param pszName The identifier of the info. * @param pszDesc The description of the info and any arguments the handler may take. * @param pfnHandler The handler function to be called to display the info. * @param pvUser User argument to be passed to the handler. */ VMMR3DECL(int) DBGFR3InfoRegisterExternal(PUVM pUVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser) { LogFlow(("DBGFR3InfoRegisterExternal: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p pvUser=%p\n", pszName, pszName, pszDesc, pszDesc, pfnHandler, pvUser)); /* * Validate the specific stuff. */ AssertPtrReturn(pfnHandler, VERR_INVALID_POINTER); UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); /* * Register */ PDBGFINFO pInfo; int rc = dbgfR3InfoRegister(pUVM, pszName, pszDesc, 0, &pInfo); if (RT_SUCCESS(rc)) { pInfo->enmType = DBGFINFOTYPE_EXT; pInfo->u.Ext.pfnHandler = pfnHandler; pInfo->u.Ext.pvUser = pvUser; RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect); } return rc; }
/** * Register a info handler owned by a driver. * * @returns VBox status code. * @param pVM Pointer to the VM. * @param pszName The identifier of the info. * @param pszDesc The description of the info and any arguments the handler may take. * @param pfnHandler The handler function to be called to display the info. * @param pDrvIns The driver instance owning the info. */ VMMR3_INT_DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns) { LogFlow(("DBGFR3InfoRegisterDriver: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p pDrvIns=%p\n", pszName, pszName, pszDesc, pszDesc, pfnHandler, pDrvIns)); /* * Validate the specific stuff. */ AssertPtrReturn(pfnHandler, VERR_INVALID_POINTER); AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER); /* * Register */ PDBGFINFO pInfo; int rc = dbgfR3InfoRegister(pVM->pUVM, pszName, pszDesc, 0, &pInfo); if (RT_SUCCESS(rc)) { pInfo->enmType = DBGFINFOTYPE_DRV; pInfo->u.Drv.pfnHandler = pfnHandler; pInfo->u.Drv.pDrvIns = pDrvIns; RTCritSectLeave(&pVM->pUVM->dbgf.s.InfoCritSect); } return rc; }