VirtualBox

Changeset 29557 in vbox


Ignore:
Timestamp:
May 17, 2010 3:01:12 PM (15 years ago)
Author:
vboxsync
Message:

Proper debug logging

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/gmm.h

    r29458 r29557  
    298298GMMR0DECL(int)  GMMR0UnregisterSharedModule(PVM pVM, VMCPUID idCpu, char *pszModuleName, char *pszVersion, RTGCPTR GCBaseAddr, uint32_t cbModule);
    299299GMMR0DECL(int)  GMMR0UnregisterAllSharedModules(PVM pVM, VMCPUID idCpu);
    300 GMMR0DECL(int)  GMMR0CheckSharedModules(PVM pVM, VMCPUID idCpu);
     300GMMR0DECL(int) GMMR0CheckSharedModules(PVM pVM, PVMCPU pVCpu);
    301301GMMR0DECL(int)  GMMR0ResetSharedModules(PVM pVM, VMCPUID idCpu);
    302 
     302#ifdef LOG_ENABLED
     303GMMR0DECL(int) GMMR0CheckSharedModulesStart(PVM pVM);
     304GMMR0DECL(int) GMMR0CheckSharedModulesEnd(PVM pVM);
     305#endif
    303306
    304307
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r29554 r29557  
    151151*******************************************************************************/
    152152#define LOG_GROUP LOG_GROUP_GMM
     153#include <VBox/vm.h>
    153154#include <VBox/gmm.h>
    154155#include "GMMR0Internal.h"
     
    39933994#endif
    39943995
    3995 /**
    3996  * Check all shared modules for the specified VM
     3996#ifdef DEBUG_sandervl
     3997/**
     3998 * Setup for a GMMR0CheckSharedModules call (to allow log flush jumps back to ring 3)
    39973999 *
    39984000 * @returns VBox status code.
    39994001 * @param   pVM                 VM handle
    4000  * @param   idCpu               VCPU id
    4001  */
    4002 GMMR0DECL(int) GMMR0CheckSharedModules(PVM pVM, VMCPUID idCpu)
     4002 */
     4003GMMR0DECL(int) GMMR0CheckSharedModulesStart(PVM pVM)
     4004{
     4005    /*
     4006     * Validate input and get the basics.
     4007     */
     4008    PGMM pGMM;
     4009    GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR);
     4010
     4011    /*
     4012     * Take the sempahore and do some more validations.
     4013     */
     4014    int rc = RTSemFastMutexRequest(pGMM->Mtx);
     4015    AssertRC(rc);
     4016    if (!GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
     4017        rc = VERR_INTERNAL_ERROR_5;
     4018    else
     4019        rc = VINF_SUCCESS;
     4020
     4021    return rc;
     4022}
     4023
     4024/**
     4025 * Clean up after a GMMR0CheckSharedModules call (to allow log flush jumps back to ring 3)
     4026 *
     4027 * @returns VBox status code.
     4028 * @param   pVM                 VM handle
     4029 */
     4030GMMR0DECL(int) GMMR0CheckSharedModulesEnd(PVM pVM)
     4031{
     4032    /*
     4033     * Validate input and get the basics.
     4034     */
     4035    PGMM pGMM;
     4036    GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR);
     4037
     4038    RTSemFastMutexRelease(pGMM->Mtx);
     4039    return VINF_SUCCESS;
     4040}
     4041#endif
     4042
     4043/**
     4044 * Check all shared modules for the specified VM
     4045 *
     4046 * @returns VBox status code.
     4047 * @param   pVM                 VM handle
     4048 * @param   pVCpu               VMCPU handle
     4049 */
     4050GMMR0DECL(int) GMMR0CheckSharedModules(PVM pVM, PVMCPU pVCpu)
    40034051{
    40044052#ifdef VBOX_WITH_PAGE_SHARING
     
    40094057    GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR);
    40104058    PGVM pGVM;
    4011     int rc = GVMMR0ByVMAndEMT(pVM, idCpu, &pGVM);
     4059    int rc = GVMMR0ByVMAndEMT(pVM, pVCpu->idCpu, &pGVM);
    40124060    if (RT_FAILURE(rc))
    40134061        return rc;
    40144062
     4063# ifndef DEBUG_sandervl
    40154064    /*
    40164065     * Take the sempahore and do some more validations.
     
    40184067    rc = RTSemFastMutexRequest(pGMM->Mtx);
    40194068    AssertRC(rc);
     4069# endif
    40204070    if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
    40214071    {
     
    40244074        Log(("GMMR0CheckSharedModules\n"));
    40254075        Info.pGVM = pGVM;
    4026         Info.idCpu = idCpu;
     4076        Info.idCpu = pVCpu->idCpu;
    40274077
    40284078        RTAvlGCPtrDoWithAll(&pGVM->gmm.s.pSharedModuleTree, true /* fFromLeft */, gmmR0CheckSharedModule, &Info);
     
    40354085        rc = VERR_INTERNAL_ERROR_5;
    40364086
     4087# ifndef DEBUG_sandervl
    40374088    RTSemFastMutexRelease(pGMM->Mtx);
     4089# endif
    40384090    return rc;
    40394091#else
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r29521 r29557  
    969969            ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
    970970
    971             int rc = GMMR0CheckSharedModules(pVM, idCpu);
     971# ifdef DEBUG_sandervl
     972            /* Make sure that log flushes can jump back to ring-3; annoying to get an incomplete log (this is risky though as the code doesn't take this into account). */
     973            int rc = GMMR0CheckSharedModulesStart(pVM);
     974            if (rc == VINF_SUCCESS)
     975            {
     976                rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, GMMR0CheckSharedModules, pVM, pVCpu); /* this may resume code. */
     977                GMMR0CheckSharedModulesEnd(pVM);
     978            }
     979# else
     980            int rc = GMMR0CheckSharedModules(pVM, pVCpu);
     981# endif
    972982
    973983            /* Clear the VCPU context. */
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