memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanContainers.cpp
branchRCL_3
changeset 59 8ad140f3dd41
parent 49 7fdc9a71d314
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
   144         // We are enumerating an entire container - not a thread-specific request
   144         // We are enumerating an entire container - not a thread-specific request
   145         const TObjectType type = ObjectTypeFromMemSpyContainerType( params.iContainer );
   145         const TObjectType type = ObjectTypeFromMemSpyContainerType( params.iContainer );
   146 
   146 
   147         DObjectCon* container = Kern::Containers()[type];
   147         DObjectCon* container = Kern::Containers()[type];
   148         container->Wait();
   148         container->Wait();
       
   149         NKern::LockSystem();
   149 
   150 
   150         const TInt count = container->Count();
   151         const TInt count = container->Count();
   151         for(TInt i=0; i<count; i++)
   152         for(TInt i=0; i<count; i++)
   152             {
   153             {
   153             DObject* object = (*container)[ i ];
   154             DObject* object = (*container)[ i ];
   155                 {
   156                 {
   156                 AddTempHandle( object );
   157                 AddTempHandle( object );
   157                 }
   158                 }
   158             }
   159             }
   159 
   160 
       
   161         NKern::UnlockSystem();
   160         container->Signal();
   162         container->Signal();
       
   163 
   161     	NKern::ThreadLeaveCS();
   164     	NKern::ThreadLeaveCS();
   162         }
   165         }
   163     else
   166     else
   164         {
   167         {
   165         // Are we dealing with threads or processes?
   168         // Are we dealing with threads or processes?
   209                 {
   212                 {
   210 	            NKern::ThreadEnterCS();
   213 	            NKern::ThreadEnterCS();
   211 
   214 
   212                 // Iterate through each handle in the thread/process and add it to the temp handles container if
   215                 // Iterate through each handle in the thread/process and add it to the temp handles container if
   213                 // the handle is of the correct type.
   216                 // the handle is of the correct type.
   214 
   217                 MemSpyObjectIx_Wait( handles );
   215 				MemSpyObjectIx_HandleLookupLock();
   218 
   216 				const TInt handleCount = handles->Count();
   219 	            TInt handleCount = handles->Count();
   217 				MemSpyObjectIx_HandleLookupUnlock();
       
   218                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - %d handles in index...", handleCount ));
   220                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetContainerHandles - %d handles in index...", handleCount ));
   219 
   221 
   220                 for( TInt handleIndex=0; handleIndex<handleCount; handleIndex++ )
   222                 for( TInt handleIndex=0; handleIndex<handleCount; handleIndex++ )
   221     	            {
   223     	            {
   222     	            // Get a handle from the container...
   224     	            // Get a handle from the container...
   223 					MemSpyObjectIx_HandleLookupLock();
   225                     NKern::LockSystem();
   224 					if (handleIndex >= handles->Count()) break; // Count may have changed in the meantime
   226     	            DObject* objectToSearchFor = (*handles)[ handleIndex ];
   225     				DObject* objectToSearchFor = (*handles)[ handleIndex ];
   227                     NKern::UnlockSystem();
   226 					if (objectToSearchFor && objectToSearchFor->Open() != KErrNone) objectToSearchFor = NULL;
       
   227 					MemSpyObjectIx_HandleLookupUnlock();
       
   228         
   228         
   229                     if (objectToSearchFor && OSAdaption().DThread().GetObjectType(*objectToSearchFor) == ObjectTypeFromMemSpyContainerType(params.iContainer))
   229                     if  ( objectToSearchFor != NULL )
   230                         {
   230                         {
   231                         // Found a match in the specified container. Write the object's handle (aka the object address)
   231                         // Check to see if this object is of the specified type. We can use quick mode
   232                         // back to the client address space
   232                         // because we know the object is valid since it's registered as a handle of the
   233                         AddTempHandle( objectToSearchFor );
   233                         // thread/process.
       
   234                         DObject* matchResult = CheckIfObjectIsInContainer( params.iContainer, objectToSearchFor, ETrue );
       
   235                         if  ( matchResult )
       
   236                             {
       
   237                             // Found a match in the specified container. Write the object's handle (aka the object address)
       
   238                             // back to the client address space
       
   239                             AddTempHandle( matchResult );
       
   240                             }
   234                         }
   241                         }
   235 					if (objectToSearchFor) objectToSearchFor->Close(NULL);
       
   236     	            }
   242     	            }
   237 
   243 
       
   244                 MemSpyObjectIx_Signal( handles );
   238                 NKern::ThreadLeaveCS();
   245                 NKern::ThreadLeaveCS();
   239                 }
   246                 }
   240 
   247 
   241             // Done with this now.
   248             // Done with this now.
   242             CloseTempObject();
   249             CloseTempObject();
   298 
   305 
   299 	NKern::ThreadEnterCS();
   306 	NKern::ThreadEnterCS();
   300 
   307 
   301     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   308     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   302     DObject* handleAsObject = (DObject*) params.iHandle;
   309     DObject* handleAsObject = (DObject*) params.iHandle;
   303     handleAsObject = CheckedOpen(params.iType, handleAsObject);
   310     handleAsObject = CheckIfObjectIsInContainer( params.iType, handleAsObject );
   304     if  ( handleAsObject != NULL )
   311     if  ( handleAsObject != NULL )
   305         {
   312         {
   306         // We found the right object. First get generic info.
   313         // We found the right object. First get generic info.
   307         handleAsObject->FullName( params.iName );
   314         handleAsObject->FullName( params.iName );
   308         handleAsObject->Name( params.iNameDetail );
   315         handleAsObject->Name( params.iNameDetail );
   309         
   316         
   310         // Using threadAddaption to fetch generic info.
   317         NKern::LockSystem();
   311         // Implementations of following get functions are actually in DMemSpyDriverOSAdaptionDObject
   318         r = handleAsObject->Open();
   312         // so it does not matter what adaption to use for generic info.
   319         NKern::UnlockSystem();
   313         DMemSpyDriverOSAdaptionDThread& threadAddaption = OSAdaption().DThread();
   320         //
   314         params.iAccessCount = threadAddaption.GetAccessCount( *handleAsObject );
   321         if  ( r == KErrNone )
   315         params.iUniqueID = threadAddaption.GetUniqueID( *handleAsObject );
   322             {
   316         params.iProtection = threadAddaption.GetProtection( *handleAsObject );
   323             // Using threadAddaption to fetch generic info.
   317         params.iAddressOfKernelOwner = threadAddaption.GetAddressOfKernelOwner( *handleAsObject );
   324             // Implementations of following get functions are actually in DMemSpyDriverOSAdaptionDObject
       
   325             // so it does not matter what adaption to use for generic info.
       
   326             DMemSpyDriverOSAdaptionDThread& threadAddaption = OSAdaption().DThread();
       
   327             params.iAccessCount = threadAddaption.GetAccessCount( *handleAsObject );
       
   328             params.iUniqueID = threadAddaption.GetUniqueID( *handleAsObject );
       
   329             params.iProtection = threadAddaption.GetProtection( *handleAsObject );
       
   330             params.iAddressOfKernelOwner = threadAddaption.GetAddressOfKernelOwner( *handleAsObject );
       
   331             //
       
   332             handleAsObject->Close( NULL );
       
   333             }
   318         
   334         
   319         // Get type-specific info.
   335         // Get type-specific info.
   320         if  ( params.iType == EMemSpyDriverContainerTypeThread )
   336         if  ( params.iType == EMemSpyDriverContainerTypeThread )
   321             {
   337             {
   322 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeThread" ));
   338 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeThread" ));
   323 
   339 
   324             DThread* object = (DThread*) handleAsObject;
   340             DThread* object = (DThread*) handleAsObject;
   325             DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
   341 	        NKern::LockSystem();
   326             //
   342             r = object->Open();
   327             params.iId = threadAdaption.GetId( *object );
   343     	    NKern::UnlockSystem();
   328             params.iPriority = threadAdaption.GetPriority( *object );
   344             //
   329             params.iAddressOfOwningProcess = threadAdaption.GetAddressOfOwningProcess( *object );
   345             if  ( r == KErrNone )
   330             threadAdaption.GetNameOfOwningProcess( *object, params.iNameOfOwner );
   346                 {
       
   347                 DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
       
   348                 //
       
   349                 params.iId = threadAdaption.GetId( *object );
       
   350                 params.iPriority = threadAdaption.GetPriority( *object );
       
   351                 params.iAddressOfOwningProcess = threadAdaption.GetAddressOfOwningProcess( *object );
       
   352                 threadAdaption.GetNameOfOwningProcess( *object, params.iNameOfOwner );
       
   353                 //
       
   354                 object->Close( NULL );
       
   355                 }
   331             }
   356             }
   332         else if ( params.iType == EMemSpyDriverContainerTypeProcess )
   357         else if ( params.iType == EMemSpyDriverContainerTypeProcess )
   333             {
   358             {
   334 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeProcess" ));
   359 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeProcess" ));
   335 
   360 
   336             DProcess* object = (DProcess*) handleAsObject;
   361             DProcess* object = (DProcess*) handleAsObject;
   337             DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
   362 	        NKern::LockSystem();
   338             //
   363             r = object->Open();
   339             params.iId = processAdaption.GetId( *object );
   364     	    NKern::UnlockSystem();
   340             //
   365             //
   341             params.iPriority = processAdaption.GetPriority( *object );
   366             if  ( r == KErrNone )
   342             params.iAddressOfOwningProcess = processAdaption.GetAddressOfOwningProcess( *object );
   367                 {
   343             params.iCreatorId = processAdaption.GetCreatorId( *object );
   368                 DMemSpyDriverOSAdaptionDProcess& processAdaption = OSAdaption().DProcess();
   344             params.iSecurityZone = processAdaption.GetSecurityZone( *object );
   369                 //
   345             params.iAttributes = processAdaption.GetAttributes( *object );
   370                 params.iId = processAdaption.GetId( *object );
   346             params.iAddressOfDataBssStackChunk = processAdaption.GetAddressOfDataBssStackChunk( *object );
   371                 //
       
   372                 params.iPriority = processAdaption.GetPriority( *object );
       
   373                 params.iAddressOfOwningProcess = processAdaption.GetAddressOfOwningProcess( *object );
       
   374                 params.iCreatorId = processAdaption.GetCreatorId( *object );
       
   375                 params.iSecurityZone = processAdaption.GetSecurityZone( *object );
       
   376                 params.iAttributes = processAdaption.GetAttributes( *object );
       
   377                 params.iAddressOfDataBssStackChunk = processAdaption.GetAddressOfDataBssStackChunk( *object );
       
   378                 //
       
   379                 object->Close( NULL );
       
   380                 }
   347             }
   381             }
   348         else if ( params.iType == EMemSpyDriverContainerTypeChunk )
   382         else if ( params.iType == EMemSpyDriverContainerTypeChunk )
   349             {
   383             {
   350 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChunk" ));
   384 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChunk" ));
   351 
   385 
   352             DChunk* object = (DChunk*) handleAsObject;
   386             DChunk* object = (DChunk*) handleAsObject;
   353             DMemSpyDriverOSAdaptionDChunk& ca = OSAdaption().DChunk();
   387 	        NKern::LockSystem();
   354             //
   388             r = object->Open();
   355             params.iSize = ca.GetSize( *object );
   389     	    NKern::UnlockSystem();
   356             params.iId = ca.GetOwningProcessId( *object );
   390             //
   357             params.iAddressOfOwningProcess = ca.GetAddressOfOwningProcess( *object );
   391             if  ( r == KErrNone )
   358             params.iMaxSize = ca.GetMaxSize( *object );
   392                 {
   359             params.iBottom = ca.GetBottom( *object );
   393                 DMemSpyDriverOSAdaptionDChunk& ca = OSAdaption().DChunk();
   360             params.iTop = ca.GetTop( *object );
   394                 //
   361             params.iAttributes = ca.GetAttributes( *object );
   395                 params.iSize = ca.GetSize( *object );
   362             params.iStartPos = ca.GetStartPos( *object );
   396                 params.iId = ca.GetOwningProcessId( *object );
   363             params.iControllingOwner = ca.GetControllingOwnerId( *object );
   397                 params.iAddressOfOwningProcess = ca.GetAddressOfOwningProcess( *object );
   364             params.iRestrictions = ca.GetRestrictions( *object );
   398                 params.iMaxSize = ca.GetMaxSize( *object );
   365             params.iMapAttr = ca.GetMapAttr( *object );
   399                 params.iBottom = ca.GetBottom( *object );
   366             params.iChunkType = ca.GetType( *object );
   400                 params.iTop = ca.GetTop( *object );
   367             ca.GetNameOfOwningProcess( *object, params.iNameOfOwner );
   401                 params.iAttributes = ca.GetAttributes( *object );
       
   402                 params.iStartPos = ca.GetStartPos( *object );
       
   403                 params.iControllingOwner = ca.GetControllingOwnerId( *object );
       
   404                 params.iRestrictions = ca.GetRestrictions( *object );
       
   405                 params.iMapAttr = ca.GetMapAttr( *object );
       
   406                 params.iChunkType = ca.GetType( *object );
       
   407                 ca.GetNameOfOwningProcess( *object, params.iNameOfOwner );
       
   408                 //
       
   409                 object->Close( NULL );
       
   410                 }
   368             }
   411             }
   369         else if ( params.iType == EMemSpyDriverContainerTypeLibrary )
   412         else if ( params.iType == EMemSpyDriverContainerTypeLibrary )
   370             {
   413             {
   371 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLibrary" ));
   414 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLibrary" ));
   372 
   415 
   373 	        Kern::AccessCode();
   416 	        Kern::AccessCode();
   374             //
   417             //
   375             DLibrary* object = (DLibrary*) handleAsObject;
   418             DLibrary* object = (DLibrary*) handleAsObject;
   376             DMemSpyDriverOSAdaptionDCodeSeg& csa = OSAdaption().DCodeSeg();
   419 	        NKern::LockSystem();
   377             DCodeSeg* codeSeg = csa.GetCodeSeg( *object );
   420             r = object->Open();
   378             params.iAddressOfCodeSeg = (TUint8*)codeSeg;
   421     	    NKern::UnlockSystem();
   379             params.iMapCount = csa.GetMapCount( *object );
   422             //
   380             params.iState = csa.GetState( *object );
   423             if  ( r == KErrNone )
   381             //
   424                 {
   382             if  ( codeSeg )
   425                 DMemSpyDriverOSAdaptionDCodeSeg& csa = OSAdaption().DCodeSeg();
   383                 {
   426                 DCodeSeg* codeSeg = csa.GetCodeSeg( *object );
   384                 params.iSize = csa.GetSize( *codeSeg );
   427                 params.iAddressOfCodeSeg = (TUint8*)codeSeg;
   385                 }
   428                 params.iMapCount = csa.GetMapCount( *object );
   386             else
   429                 params.iState = csa.GetState( *object );
   387                 {
   430                 //
   388                 r = KErrNotFound;
   431                 if  ( codeSeg )
       
   432                     {
       
   433                     params.iSize = csa.GetSize( *codeSeg );
       
   434                     }
       
   435                 else
       
   436                     {
       
   437                     r = KErrNotFound;
       
   438                     }
       
   439                 //
       
   440                 object->Close( NULL );
   389                 }
   441                 }
   390             //
   442             //
   391 	        Kern::EndAccessCode();
   443 	        Kern::EndAccessCode();
   392             }
   444             }
   393         else if ( params.iType == EMemSpyDriverContainerTypeSemaphore )
   445         else if ( params.iType == EMemSpyDriverContainerTypeSemaphore )
   394             {
   446             {
   395 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSemaphore" ));
   447 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSemaphore" ));
   396 
   448 
   397             DSemaphore* object = (DSemaphore*) handleAsObject;
   449             DSemaphore* object = (DSemaphore*) handleAsObject;
   398             DMemSpyDriverOSAdaptionDSemaphore& sa = OSAdaption().DSemaphore();
   450 	        NKern::LockSystem();
   399             params.iCount = sa.GetCount( *object );
   451             r = object->Open();
   400             params.iResetting = sa.GetResetting( *object );
   452     	    NKern::UnlockSystem();
       
   453             //
       
   454             if  ( r == KErrNone )
       
   455                 {
       
   456                 DMemSpyDriverOSAdaptionDSemaphore& sa = OSAdaption().DSemaphore();
       
   457                 params.iCount = sa.GetCount( *object );
       
   458                 params.iResetting = sa.GetResetting( *object );
       
   459                 //
       
   460                 object->Close( NULL );
       
   461                 }
   401             }
   462             }
   402         else if ( params.iType == EMemSpyDriverContainerTypeMutex )
   463         else if ( params.iType == EMemSpyDriverContainerTypeMutex )
   403             {
   464             {
   404 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMutex" ));
   465 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMutex" ));
   405 
   466 
   406             DMutex* object = (DMutex*) handleAsObject;
   467             DMutex* object = (DMutex*) handleAsObject;
   407             DMemSpyDriverOSAdaptionDMutex& ma = OSAdaption().DMutex();
   468 	        NKern::LockSystem();
   408             //
   469             r = object->Open();
   409             params.iCount = ma.GetHoldCount( *object );
   470     	    NKern::UnlockSystem();
   410             params.iWaitCount = ma.GetWaitCount( *object );
   471             //
   411             params.iResetting = ma.GetResetting( *object );
   472             if  ( r == KErrNone )
   412             params.iOrder = ma.GetOrder( *object );
   473                 {
       
   474                 DMemSpyDriverOSAdaptionDMutex& ma = OSAdaption().DMutex();
       
   475                 //
       
   476                 params.iCount = ma.GetHoldCount( *object );
       
   477                 params.iWaitCount = ma.GetWaitCount( *object );
       
   478                 params.iResetting = ma.GetResetting( *object );
       
   479                 params.iOrder = ma.GetOrder( *object );
       
   480                 //
       
   481                 object->Close( NULL );
       
   482                 }
   413             }
   483             }
   414         else if ( params.iType == EMemSpyDriverContainerTypeTimer )
   484         else if ( params.iType == EMemSpyDriverContainerTypeTimer )
   415             {
   485             {
   416 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeTimer" ));
   486 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeTimer" ));
   417 
   487 
   418             // Get timer properties
   488             // Get timer properties
   419             DTimer* object = (DTimer*) handleAsObject;
   489             DTimer* object = (DTimer*) handleAsObject;
   420             DMemSpyDriverOSAdaptionDTimer& ta = OSAdaption().DTimer();
   490 	        NKern::LockSystem();
   421             //
   491             r = object->Open();
   422             params.iTimerType = MapToMemSpyTimerType( ta.GetType( *object ) );
   492     	    NKern::UnlockSystem();
   423             params.iTimerState = MapToMemSpyTimerState( ta.GetState( *object ) );
   493             //
       
   494             if  ( r == KErrNone )
       
   495                 {
       
   496                 DMemSpyDriverOSAdaptionDTimer& ta = OSAdaption().DTimer();
       
   497                 //
       
   498                 params.iTimerType = MapToMemSpyTimerType( ta.GetType( *object ) );
       
   499                 params.iTimerState = MapToMemSpyTimerState( ta.GetState( *object ) );
       
   500                 //
       
   501                 object->Close( NULL );
       
   502                 }
   424             }
   503             }
   425         else if ( params.iType == EMemSpyDriverContainerTypeServer )
   504         else if ( params.iType == EMemSpyDriverContainerTypeServer )
   426             {
   505             {
   427 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeServer" ));
   506 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeServer" ));
   428 
   507 
   429             DServer* object = (DServer*) handleAsObject;
   508             DServer* object = (DServer*) handleAsObject;
   430             DMemSpyDriverOSAdaptionDServer& sa = OSAdaption().DServer();
   509 	        NKern::LockSystem();
   431             //
   510             r = object->Open();
   432             params.iCount = sa.GetSessionCount( *object );
   511     	    NKern::UnlockSystem();
   433             params.iId = sa.GetOwningThreadId( *object );
   512             //
   434             params.iSessionType = sa.GetSessionType( *object );
   513             if  ( r == KErrNone )
   435             params.iAddressOfOwningThread = sa.GetAddressOfOwningThread( *object );
   514                 {
   436             sa.GetNameOfOwningThread( *object, params.iNameOfOwner );
   515                 DMemSpyDriverOSAdaptionDServer& sa = OSAdaption().DServer();
       
   516                 //
       
   517                 params.iCount = sa.GetSessionCount( *object );
       
   518                 params.iId = sa.GetOwningThreadId( *object );
       
   519                 params.iSessionType = sa.GetSessionType( *object );
       
   520                 params.iAddressOfOwningThread = sa.GetAddressOfOwningThread( *object );
       
   521                 sa.GetNameOfOwningThread( *object, params.iNameOfOwner );
       
   522                 //
       
   523                 object->Close( NULL );
       
   524                 }
   437             }
   525             }
   438         else if ( params.iType == EMemSpyDriverContainerTypeSession )
   526         else if ( params.iType == EMemSpyDriverContainerTypeSession )
   439             {
   527             {
   440 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSession" ));
   528 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeSession" ));
   441 
   529 
   442             DSession* object = (DSession*) handleAsObject;
   530             DSession* object = (DSession*) handleAsObject;
   443             DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
   531 	        NKern::LockSystem();
   444             DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
   532             r = object->Open();
   445 
   533     	    NKern::UnlockSystem();
   446             params.iName.Zero();
   534             //
   447 
   535 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - open error: %d", r ));
   448             TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting session type..." ));
   536             if  ( r == KErrNone )
   449             params.iSessionType = sessionAdaption.GetSessionType( *object );
   537                 {
   450             params.iAddressOfServer = sessionAdaption.GetAddressOfServer( *object );
   538                 DMemSpyDriverOSAdaptionDServer& serverAdaption = OSAdaption().DServer();
   451             params.iTotalAccessCount = sessionAdaption.GetTotalAccessCount( *object );
   539                 DMemSpyDriverOSAdaptionDSession& sessionAdaption = OSAdaption().DSession();
   452             params.iSvrSessionType = sessionAdaption.GetSessionType( *object );
   540 
   453             params.iMsgCount = sessionAdaption.GetMsgCount( *object );
   541                 params.iName.Zero();
   454             params.iMsgLimit = sessionAdaption.GetMsgLimit( *object );
   542 
   455             
   543                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting session type..." ));
   456             // Its more useful in this instance, if the name object
   544                 params.iSessionType = sessionAdaption.GetSessionType( *object );
   457             // points to the server which the session is connected to
   545                 params.iAddressOfServer = sessionAdaption.GetAddressOfServer( *object );
   458             // (rather than displaying a process-local name).
   546                 params.iTotalAccessCount = sessionAdaption.GetTotalAccessCount( *object );
   459             DServer* server = (DServer*)CheckedOpen(EMemSpyDriverContainerTypeServer, sessionAdaption.GetServer( *object ));
   547                 params.iSvrSessionType = sessionAdaption.GetSessionType( *object );
   460 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting full name, server: 0x%08x", server ));
   548                 params.iMsgCount = sessionAdaption.GetMsgCount( *object );
   461             //
   549                 params.iMsgLimit = sessionAdaption.GetMsgLimit( *object );
   462             if  ( server )
   550                 
   463                 {
   551                 // Its more useful in this instance, if the name object
   464                 server->FullName( params.iName );
   552                 // points to the server which the session is connected to
   465 
   553                 // (rather than displaying a process-local name).
   466                 // Continue as normal for other items
   554                 DServer* server = sessionAdaption.GetServer( *object );
   467 	            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - server: 0x%08x, server->iOwningThread: 0x%08x", server, server->iOwningThread ));
   555 	            TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting full name, server: 0x%08x", server ));
   468                 DThread* owningThread = serverAdaption.GetOwningThread( *server );
   556                 //
   469                 if  ( owningThread )
   557                 if  ( server )
   470                     {
   558                     {
   471 	                TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting server thread id..." ));
   559 	                NKern::LockSystem();
   472                     params.iId = serverAdaption.GetOwningThreadId( *server );
   560                     r = server->Open();
       
   561      	            NKern::UnlockSystem();
       
   562 
       
   563                     if  ( r == KErrNone )
       
   564                         {
       
   565                         server->FullName( params.iName );
       
   566  
       
   567                         // Continue as normal for other items
       
   568 	                    TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - server: 0x%08x, server->iOwningThread: 0x%08x", server, server->iOwningThread ));
       
   569                         DThread* owningThread = serverAdaption.GetOwningThread( *server );
       
   570                         if  ( owningThread )
       
   571                             {
       
   572 	                        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - getting server thread id..." ));
       
   573                             params.iId = serverAdaption.GetOwningThreadId( *server );
       
   574                             }
       
   575 
       
   576                         server->Close( NULL );
       
   577                         }
   473                     }
   578                     }
   474 
   579 
   475                 server->Close(NULL);
   580                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - closing session object..." ));
       
   581                 object->Close( NULL );
   476                 }
   582                 }
   477             }
   583             }
   478         else if ( params.iType == EMemSpyDriverContainerTypeLogicalDevice )
   584         else if ( params.iType == EMemSpyDriverContainerTypeLogicalDevice )
   479             {
   585             {
   480 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalDevice" ));
   586 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalDevice" ));
   481 
   587 
   482             DLogicalDevice* object = (DLogicalDevice*) handleAsObject;
   588             DLogicalDevice* object = (DLogicalDevice*) handleAsObject;
   483             DMemSpyDriverOSAdaptionDLogicalDevice& lda = OSAdaption().DLogicalDevice();
   589 	        NKern::LockSystem();
   484             params.iOpenChannels = lda.GetOpenChannels( *object );
   590             r = object->Open();
   485             params.iVersion = lda.GetVersion( *object );
   591     	    NKern::UnlockSystem();
   486             params.iParseMask = lda.GetParseMask( *object );
   592             //
   487             params.iUnitsMask = lda.GetUnitsMask( *object );
   593             if  ( r == KErrNone )
       
   594                 {
       
   595                 DMemSpyDriverOSAdaptionDLogicalDevice& lda = OSAdaption().DLogicalDevice();
       
   596                 params.iOpenChannels = lda.GetOpenChannels( *object );
       
   597                 params.iVersion = lda.GetVersion( *object );
       
   598                 params.iParseMask = lda.GetParseMask( *object );
       
   599                 params.iUnitsMask = lda.GetUnitsMask( *object );
       
   600                 //
       
   601                 object->Close( NULL );
       
   602                 }
   488             }
   603             }
   489         else if ( params.iType == EMemSpyDriverContainerTypePhysicalDevice )
   604         else if ( params.iType == EMemSpyDriverContainerTypePhysicalDevice )
   490             {
   605             {
   491 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePhysicalDevice" ));
   606 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypePhysicalDevice" ));
   492 	        
   607 	        
   493 	        DPhysicalDevice* object = (DPhysicalDevice*) handleAsObject;
   608 	        DPhysicalDevice* object = (DPhysicalDevice*) handleAsObject;
   494             DMemSpyDriverOSAdaptionDPhysicalDevice& pda = OSAdaption().DPhysicalDevice();
   609             NKern::LockSystem();
   495             params.iVersion = pda.GetVersion( *object );
   610             r = object->Open();
   496             params.iUnitsMask = pda.GetUnitsMask( *object );
   611             NKern::UnlockSystem();
   497             params.iAddressOfCodeSeg = pda.GetAddressOfCodeSeg( *object );
   612             //
       
   613             if  ( r == KErrNone )
       
   614                 {
       
   615                 DMemSpyDriverOSAdaptionDPhysicalDevice& pda = OSAdaption().DPhysicalDevice();
       
   616                 params.iVersion = pda.GetVersion( *object );
       
   617                 params.iUnitsMask = pda.GetUnitsMask( *object );
       
   618                 params.iAddressOfCodeSeg = pda.GetAddressOfCodeSeg( *object );
       
   619                 //
       
   620                 object->Close( NULL );
       
   621                 }
   498             }
   622             }
   499         else if ( params.iType == EMemSpyDriverContainerTypeLogicalChannel )
   623         else if ( params.iType == EMemSpyDriverContainerTypeLogicalChannel )
   500             {
   624             {
   501 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalChannel" ));
   625 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeLogicalChannel" ));
   502             }
   626             }
   503         else if ( params.iType == EMemSpyDriverContainerTypeChangeNotifier )
   627         else if ( params.iType == EMemSpyDriverContainerTypeChangeNotifier )
   504             {
   628             {
   505 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChangeNotifier" ));
   629 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeChangeNotifier" ));
   506 
   630 
   507 	        DChangeNotifier* object = (DChangeNotifier*) handleAsObject;
   631 	        DChangeNotifier* object = (DChangeNotifier*) handleAsObject;
   508             DMemSpyDriverOSAdaptionDChangeNotifier& cna = OSAdaption().DChangeNotifier();
   632             NKern::LockSystem();
   509             params.iChanges = cna.GetChanges( *object );
   633             r = object->Open();
   510             params.iAddressOfOwningThread = cna.GetAddressOfOwningThread( *object );
   634             NKern::UnlockSystem();
   511             cna.GetNameOfOwningThread( *object, params.iNameOfOwner );
   635             //
       
   636             if  ( r == KErrNone )
       
   637                 {
       
   638                 DMemSpyDriverOSAdaptionDChangeNotifier& cna = OSAdaption().DChangeNotifier();
       
   639                 params.iChanges = cna.GetChanges( *object );
       
   640                 params.iAddressOfOwningThread = cna.GetAddressOfOwningThread( *object );
       
   641                 cna.GetNameOfOwningThread( *object, params.iNameOfOwner );
       
   642                 //
       
   643                 object->Close( NULL );
       
   644                 }
   512             }
   645             }
   513         else if ( params.iType == EMemSpyDriverContainerTypeUndertaker )
   646         else if ( params.iType == EMemSpyDriverContainerTypeUndertaker )
   514             {
   647             {
   515 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeUndertaker" ));
   648 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeUndertaker" ));
   516 	        
   649 	        
   517             DUndertaker* object = (DUndertaker*) handleAsObject;
   650             DUndertaker* object = (DUndertaker*) handleAsObject;
   518             DMemSpyDriverOSAdaptionDUndertaker& uta = OSAdaption().DUndertaker();
   651             NKern::LockSystem();
   519             params.iAddressOfOwningThread = uta.GetAddressOfOwningThread( *object );
   652             r = object->Open();
   520             uta.GetNameOfOwningThread( *object, params.iNameOfOwner );
   653             NKern::UnlockSystem();
       
   654             //
       
   655             if  ( r == KErrNone )
       
   656                 {
       
   657                 DMemSpyDriverOSAdaptionDUndertaker& uta = OSAdaption().DUndertaker();
       
   658                 params.iAddressOfOwningThread = uta.GetAddressOfOwningThread( *object );
       
   659                 uta.GetNameOfOwningThread( *object, params.iNameOfOwner );
       
   660                 //
       
   661                 object->Close( NULL );
       
   662                 }
   521             }
   663             }
   522         else if ( params.iType == EMemSpyDriverContainerTypeMsgQueue )
   664         else if ( params.iType == EMemSpyDriverContainerTypeMsgQueue )
   523             {
   665             {
   524 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMsgQueue" ));
   666 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeMsgQueue" ));
   525             }
   667             }
   530         else if ( params.iType == EMemSpyDriverContainerTypeCondVar )
   672         else if ( params.iType == EMemSpyDriverContainerTypeCondVar )
   531             {
   673             {
   532 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeCondVar" ));
   674 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - EMemSpyDriverContainerTypeCondVar" ));
   533 	        
   675 	        
   534             DCondVar* object = (DCondVar*) handleAsObject;
   676             DCondVar* object = (DCondVar*) handleAsObject;
   535             DMemSpyDriverOSAdaptionDCondVar& cva = OSAdaption().DCondVar();
   677             NKern::LockSystem();
   536             params.iResetting = cva.GetResetting( *object );
   678             r = object->Open();
   537             params.iAddressOfOwningThread = cva.GetAddressOfMutex( *object );
   679             NKern::UnlockSystem();
   538             cva.GetNameOfMutex( *object, params.iNameOfOwner );
   680             //
   539             params.iWaitCount = cva.GetWaitCount( *object );
   681             if  ( r == KErrNone )
       
   682                 {
       
   683                 DMemSpyDriverOSAdaptionDCondVar& cva = OSAdaption().DCondVar();
       
   684                 params.iResetting = cva.GetResetting( *object );
       
   685                 params.iAddressOfOwningThread = cva.GetAddressOfMutex( *object );
       
   686                 cva.GetNameOfMutex( *object, params.iNameOfOwner );
       
   687                 params.iWaitCount = cva.GetWaitCount( *object );
       
   688                 //
       
   689                 object->Close( NULL );
       
   690                 }
   540             }
   691             }
   541         else
   692         else
   542             {
   693             {
   543 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - KErrNotSupported" ));
   694 	        TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo() - KErrNotSupported" ));
   544             r = KErrNotSupported;
   695             r = KErrNotSupported;
   545             }
   696             }
   546 		handleAsObject->Close(NULL);
       
   547         }
   697         }
   548     else
   698     else
   549         {
   699         {
   550         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - couldn not find object => KErrNotFound"));
   700         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetGenericHandleInfo - couldn not find object => KErrNotFound"));
   551         r = KErrNotFound;
   701         r = KErrNotFound;
   729 
   879 
   730     TInt r = KErrNotFound;
   880     TInt r = KErrNotFound;
   731 	NKern::ThreadEnterCS();
   881 	NKern::ThreadEnterCS();
   732 
   882 
   733     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   883     // First, locate the specific DObject in question. Cast the handle, but don't use the object...
   734     DObject* object = CheckedOpen(EMemSpyDriverContainerTypePropertyRef, aHandle);
   884     // NB: This claims the system lock
       
   885     DObject* object = CheckIfObjectIsInContainer( EMemSpyDriverContainerTypePropertyRef, aHandle );
   735     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - handle search returned: 0x%08x", object ));
   886     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - handle search returned: 0x%08x", object ));
   736 
   887 
   737     if  ( object != NULL )
   888     if  ( object != NULL )
   738         {
   889         {
   739         NKern::LockSystem(); // Keep this, the DPropertyRef APIs use it -TomS
   890         NKern::LockSystem();
   740 
   891 
   741         DMemSpyDriverOSAdaptionDPropertyRef& pra = OSAdaption().DPropertyRef();
   892         DMemSpyDriverOSAdaptionDPropertyRef& pra = OSAdaption().DPropertyRef();
   742         const TBool isReady = pra.GetIsReady( *object );
   893         const TBool isReady = pra.GetIsReady( *object );
   743         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - isReady: %d", isReady ));
   894         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - isReady: %d", isReady ));
   744 
   895 
   760             {
   911             {
   761             r = KErrNotReady;
   912             r = KErrNotReady;
   762             }
   913             }
   763 
   914 
   764         NKern::UnlockSystem();
   915         NKern::UnlockSystem();
   765 		object->Close(NULL);
       
   766         }
   916         }
   767 
   917 
   768     NKern::ThreadLeaveCS();
   918     NKern::ThreadLeaveCS();
   769 
   919 
   770     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - END - r: %d", r));
   920     TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::GetPAndSInfo() - END - r: %d", r));
   787     
   937     
   788     const TInt maxCount = params.iMaxCount;
   938     const TInt maxCount = params.iMaxCount;
   789     NKern::ThreadEnterCS();
   939     NKern::ThreadEnterCS();
   790     
   940     
   791     DObject* condVarHandle = (DObject*) params.iCondVarHandle;
   941     DObject* condVarHandle = (DObject*) params.iCondVarHandle;
   792     condVarHandle = CheckedOpen(EMemSpyDriverContainerTypeCondVar, condVarHandle);
   942     condVarHandle = CheckIfObjectIsInContainer( EMemSpyDriverContainerTypeCondVar, condVarHandle );
   793     if  ( condVarHandle == NULL )
   943     if  ( condVarHandle == NULL )
   794         {
   944         {
   795         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - condVar not found");
   945         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - condVar not found");
   796         NKern::ThreadLeaveCS();
   946         NKern::ThreadLeaveCS();
   797         return KErrNotFound;
   947         return KErrNotFound;
   798         }
   948         }
   799     
   949     
   800     ResetTempHandles();
   950     ResetTempHandles();
   801         
   951         
   802     DCondVar* condVar = (DCondVar*) condVarHandle;
   952     DCondVar* condVar = (DCondVar*) params.iCondVarHandle;;
   803     
   953     
   804     NKern::LockSystem(); // Keep this, needed for iterating suspended queue -TomS
   954     NKern::LockSystem();
   805 
   955 
   806     // Iterate through suspended threads, writing back thread pointer (handle)
   956     // Iterate through suspended threads, writing back thread pointer (handle)
   807     // to client
   957     // to client
   808     SDblQue& suspQueue = condVarAdaption.GetSuspendedQ( *condVar );
   958     SDblQue& suspQueue = condVarAdaption.GetSuspendedQ( *condVar );
   809     SDblQueLink* anchor = &suspQueue.iA;
   959     SDblQueLink* anchor = &suspQueue.iA;
   851             {
  1001             {
   852             r = finalWrite;
  1002             r = finalWrite;
   853             }
  1003             }
   854         }
  1004         }
   855 
  1005 
   856 	condVarHandle->Close(NULL);
       
   857     NKern::ThreadLeaveCS();
  1006     NKern::ThreadLeaveCS();
   858 
  1007 
   859     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - r: %d", r));
  1008     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrs() - END - r: %d", r));
   860     return r;
  1009     return r;
   861     }
  1010     }
   875     DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
  1024     DMemSpyDriverOSAdaptionDThread& threadAdaption = OSAdaption().DThread();
   876 
  1025 
   877     NKern::ThreadEnterCS();
  1026     NKern::ThreadEnterCS();
   878 
  1027 
   879     DObject* threadHandle = (DObject*) aThreadHandle;
  1028     DObject* threadHandle = (DObject*) aThreadHandle;
   880     threadHandle = CheckedOpen(EMemSpyDriverContainerTypeThread, threadHandle);
  1029     threadHandle = CheckIfObjectIsInContainer( EMemSpyDriverContainerTypeThread, threadHandle );
   881     if  ( threadHandle == NULL )
  1030     if  ( threadHandle == NULL )
   882         {
  1031         {
   883         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - thread not found");
  1032         Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - thread not found");
   884         NKern::ThreadLeaveCS();
  1033         NKern::ThreadLeaveCS();
   885         return KErrNotFound;
  1034         return KErrNotFound;
   892     if  ( r == KErrNone )
  1041     if  ( r == KErrNone )
   893         {
  1042         {
   894         r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
  1043         r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverCondVarSuspendedThreadInfo) );
   895         }
  1044         }
   896     
  1045     
   897 	threadHandle->Close(NULL);
       
   898     NKern::ThreadLeaveCS();
  1046     NKern::ThreadLeaveCS();
   899     
  1047     
   900     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - r: %d", r));
  1048     TRACE( Kern::Printf("DMemSpyDriverLogChanMisc::GetCondVarSuspThrInfo() - END - r: %d", r));
   901     return r;
  1049     return r;
   902     }
  1050     }
   956         MemSpyObjectIx* handles = threadAdaption.GetHandles( *thread );
  1104         MemSpyObjectIx* handles = threadAdaption.GetHandles( *thread );
   957         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - handles: 0x%08x", handles ));
  1105         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - handles: 0x%08x", handles ));
   958 
  1106 
   959         if  ( handles != NULL )
  1107         if  ( handles != NULL )
   960             {
  1108             {
   961             TBool found = handles->Find( aHandleToLookFor );
  1109             MemSpyObjectIx_Wait( handles );
   962 	        if (found)
  1110             //
       
  1111             TInt searchResult = handles->At( aHandleToLookFor );
       
  1112 	        if  ( searchResult != KErrNotFound )
   963 		        {
  1113 		        {
   964                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - found handle match in [%O]", thread ));
  1114                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchThreadsFor - found handle match in [%O]", thread ));
   965                 aStream.WriteUint32( (TUint32) thread );
  1115                 aStream.WriteUint32( (TUint32) thread );
   966                 ++matches;
  1116                 ++matches;
   967 		        }
  1117 		        }
       
  1118             //
       
  1119             MemSpyObjectIx_Signal( handles );
   968             }
  1120             }
   969         }
  1121         }
   970 
  1122 
   971     // Finished with thread/process container.
  1123     // Finished with thread/process container.
   972     container->Signal();
  1124     container->Signal();
   997         MemSpyObjectIx* handles = processAdaption.GetHandles( *process );
  1149         MemSpyObjectIx* handles = processAdaption.GetHandles( *process );
   998         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - handles: 0x%08x", handles ));
  1150         TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - handles: 0x%08x", handles ));
   999 
  1151 
  1000         if  ( handles != NULL )
  1152         if  ( handles != NULL )
  1001             {
  1153             {
  1002             TBool found = handles->Find( aHandleToLookFor );
  1154             MemSpyObjectIx_Wait( handles );
  1003 	        if  ( found )
  1155             //
       
  1156             TInt searchResult = handles->At( aHandleToLookFor );
       
  1157 	        if  ( searchResult != KErrNotFound )
  1004 		        {
  1158 		        {
  1005                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - found handle match in [%O]", process ));
  1159                 TRACE( Kern::Printf("DMemSpyDriverLogChanContainers::SearchProcessFor - found handle match in [%O]", process ));
  1006                 aStream.WriteUint32( (TUint32) process );
  1160                 aStream.WriteUint32( (TUint32) process );
  1007                 ++matches;
  1161                 ++matches;
  1008 		        }
  1162 		        }
       
  1163             //
       
  1164             MemSpyObjectIx_Signal( handles );
  1009             }
  1165             }
  1010         }
  1166         }
  1011 
  1167 
  1012     // Finished with thread/process container.
  1168     // Finished with thread/process container.
  1013     container->Signal();
  1169     container->Signal();