VirtualBox

Changeset 2250

Show
Ignore:
Timestamp:
04/20/07 01:38:04 (2 years ago)
Author:
vboxsync
Message:

DBGFINFO_FLAGS_RUN_ON_EMT and Ex registration function.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/dbgf.h

    r2167 r2250  
    835835 
    836836 
     837/** @name Flags for the info registration functions. 
     838 * @{ */ 
     839/** The handler must run on the EMT. */ 
     840#define DBGFINFO_FLAGS_RUN_ON_EMT       BIT(0) 
     841/** @} */ 
     842 
     843 
    837844/** 
    838845 * Register a info handler owned by a device. 
     
    869876 */ 
    870877DBGFR3DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler); 
     878 
     879/** 
     880 * Register a info handler owned by an internal component. 
     881 * 
     882 * @returns VBox status code. 
     883 * @param   pVM         VM handle. 
     884 * @param   pszName     The identifier of the info. 
     885 * @param   pszDesc     The description of the info and any arguments the handler may take. 
     886 * @param   pfnHandler  The handler function to be called to display the info. 
     887 * @param   fFlags      Flags, see the DBGFINFO_FLAGS_*. 
     888 */ 
     889DBGFR3DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags); 
    871890 
    872891/** 
  • trunk/src/VBox/VMM/DBGFInfo.cpp

    r23 r2250  
    183183 * @param   pszName     The identifier of the info. 
    184184 * @param   pszDesc     The description of the info and any arguments the handler may take. 
     185 * @param   fFlags      The flags. 
    185186 * @param   ppInfo      Where to store the created 
    186187 */ 
    187 static int dbgfR3InfoRegister(PVM pVM, const char *pszName, const char *pszDesc, PDBGFINFO *ppInfo) 
     188static int dbgfR3InfoRegister(PVM pVM, const char *pszName, const char *pszDesc, uint32_t fFlags, PDBGFINFO *ppInfo) 
    188189{ 
    189190    /* 
    190191     * Validate. 
    191192     */ 
    192     if (!pszName) 
    193     { 
    194         AssertMsgFailed(("!pszName\n")); 
    195         return VERR_INVALID_PARAMETER; 
    196     } 
    197     if (!pszDesc) 
    198     { 
    199         AssertMsgFailed(("!pszDesc\n")); 
    200         return VERR_INVALID_PARAMETER; 
    201     } 
     193    AssertPtrReturn(pszName, VERR_INVALID_POINTER); 
     194    AssertReturn(*pszName, VERR_INVALID_PARAMETER); 
     195    AssertPtrReturn(pszDesc, VERR_INVALID_POINTER); 
     196    AssertMsgReturn(!(fFlags & ~(DBGFINFO_FLAGS_RUN_ON_EMT)), ("fFlags=%#x\n", fFlags), VERR_INVALID_PARAMETER); 
    202197 
    203198    /* 
     
    210205    { 
    211206        pInfo->enmType = DBGFINFOTYPE_INVALID; 
     207        pInfo->fFlags = fFlags; 
    212208        pInfo->pszDesc = pszDesc; 
    213209        pInfo->cchName = cchName - 1; 
     
    280276     */ 
    281277    PDBGFINFO pInfo; 
    282     int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, &pInfo); 
     278    int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, 0, &pInfo); 
    283279    if (VBOX_SUCCESS(rc)) 
    284280    { 
     
    326322     */ 
    327323    PDBGFINFO pInfo; 
    328     int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, &pInfo); 
     324    int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, 0, &pInfo); 
    329325    if (VBOX_SUCCESS(rc)) 
    330326    { 
     
    350346DBGFR3DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler) 
    351347{ 
    352     LogFlow(("DBGFR3InfoRegisterInternal: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n", 
    353              pszName, pszName, pszDesc, pszDesc, pfnHandler)); 
     348    return DBGFR3InfoRegisterInternalEx(pVM, pszName, pszDesc, pfnHandler, 0); 
     349
     350 
     351 
     352/** 
     353 * Register a info handler owned by an internal component. 
     354 * 
     355 * @returns VBox status code. 
     356 * @param   pVM         VM handle. 
     357 * @param   pszName     The identifier of the info. 
     358 * @param   pszDesc     The description of the info and any arguments the handler may take. 
     359 * @param   pfnHandler  The handler function to be called to display the info. 
     360 * @param   fFlags      Flags, see the DBGFINFO_FLAGS_*. 
     361 */ 
     362DBGFR3DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags) 
     363
     364    LogFlow(("DBGFR3InfoRegisterInternal: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p fFlags=%x\n", 
     365             pszName, pszName, pszDesc, pszDesc, pfnHandler, fFlags)); 
    354366 
    355367    /* 
     
    366378     */ 
    367379    PDBGFINFO pInfo; 
    368     int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, &pInfo); 
     380    int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, fFlags, &pInfo); 
    369381    if (VBOX_SUCCESS(rc)) 
    370382    { 
     
    407419     */ 
    408420    PDBGFINFO pInfo; 
    409     int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, &pInfo); 
     421    int rc = dbgfR3InfoRegister(pVM, pszName, pszDesc, 0, &pInfo); 
    410422    if (VBOX_SUCCESS(rc)) 
    411423    { 
     
    700712        AssertRC(rc); 
    701713        rc = VINF_SUCCESS; 
     714        PVMREQ pReq = NULL; 
    702715        switch (Info.enmType) 
    703716        { 
    704717            case DBGFINFOTYPE_DEV: 
    705                 Info.u.Dev.pfnHandler(Info.u.Dev.pDevIns, pHlp, pszArgs); 
     718                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 
     719                    rc = VMR3ReqCallVoid(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)Info.u.Dev.pfnHandler, 3, Info.u.Dev.pDevIns, pHlp, pszArgs); 
     720                else 
     721                    Info.u.Dev.pfnHandler(Info.u.Dev.pDevIns, pHlp, pszArgs); 
    706722                break; 
     723 
    707724            case DBGFINFOTYPE_DRV: 
    708                 Info.u.Drv.pfnHandler(Info.u.Drv.pDrvIns, pHlp, pszArgs); 
     725                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 
     726                    rc = VMR3ReqCallVoid(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)Info.u.Drv.pfnHandler, 3, Info.u.Drv.pDrvIns, pHlp, pszArgs); 
     727                else 
     728                    Info.u.Drv.pfnHandler(Info.u.Drv.pDrvIns, pHlp, pszArgs); 
    709729                break; 
     730 
    710731            case DBGFINFOTYPE_INT: 
    711                 Info.u.Int.pfnHandler(pVM, pHlp, pszArgs); 
     732                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 
     733                    rc = VMR3ReqCallVoid(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)Info.u.Int.pfnHandler, 3, pVM, pHlp, pszArgs); 
     734                else 
     735                    Info.u.Int.pfnHandler(pVM, pHlp, pszArgs); 
    712736                break; 
     737 
    713738            case DBGFINFOTYPE_EXT: 
    714                 Info.u.Ext.pfnHandler(Info.u.Ext.pvUser, pHlp, pszArgs); 
     739                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 
     740                    rc = VMR3ReqCallVoid(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)Info.u.Ext.pfnHandler, 3, Info.u.Ext.pvUser, pHlp, pszArgs); 
     741                else 
     742                    Info.u.Ext.pfnHandler(Info.u.Ext.pvUser, pHlp, pszArgs); 
    715743                break; 
     744 
    716745            default: 
    717746                AssertMsgFailed(("Invalid info type enmType=%d\n", Info.enmType)); 
     
    719748                break; 
    720749        } 
     750        VMR3ReqFree(pReq); 
    721751    } 
    722752    else 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy