memspy/MemSpyServer/Source/MemSpyServerSession.cpp
changeset 30 86a2e675b80a
parent 26 4fde310f06fe
child 36 813b186005b6
equal deleted inserted replaced
26:4fde310f06fe 30:86a2e675b80a
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Implementation of the new MemSpyServer
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <e32svr.h>
       
    20 #include <e32cmn.h>
       
    21 #include <e32base.h>
       
    22 #include <w32std.h>
       
    23 //#include <apgtask.h>
       
    24 //#include <apgwgnam.h>
       
    25 
       
    26 //user includes
       
    27 #include "MemSpyServerSession.h"
       
    28 
       
    29 // User includes
       
    30 #include <memspy/engine/memspyengine.h>
       
    31 #include <memspy/engine/memspyenginelogger.h>
       
    32 #include <memspyengineclientinterface.h>
       
    33 #include <memspy/engine/memspyengineobjectthread.h>
       
    34 #include <memspy/engine/memspyengineobjectprocess.h>
       
    35 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    36 #include <memspy/engine/memspyenginehelperchunk.h>
       
    37 #include <memspy/engine/memspyenginehelpercodesegment.h>
       
    38 #include <memspy/engine/memspyenginehelperheap.h>
       
    39 #include <memspy/engine/memspyenginehelperstack.h>
       
    40 #include <memspy/engine/memspyenginehelperthread.h>
       
    41 #include <memspy/engine/memspyenginehelperprocess.h>
       
    42 #include <memspy/engine/memspyenginehelperfilesystem.h>
       
    43 #include <memspy/engine/memspyenginehelperram.h>
       
    44 #include <memspy/engine/memspyenginehelpersysmemtracker.h>
       
    45 #include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
       
    46 #include <memspy/engine/memspyenginehelperkernelcontainers.h>
       
    47 #include <memspy/engine/memspyenginehelperserver.h>
       
    48 
       
    49 //cigasto
       
    50 #include <memspysession.h>
       
    51 //#include <memspy/driver/memspydriverclient.h>
       
    52 
       
    53 // ---------------------------------------------------------
       
    54 // CMemSpyServerSession( CMemSpyEngine& aEngine )
       
    55 // ---------------------------------------------------------
       
    56 //
       
    57 CMemSpyServerSession::CMemSpyServerSession( CMemSpyEngine& aEngine )
       
    58 :   iEngine( aEngine )
       
    59     {	
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------
       
    63 // ~CMemSpyServerSession()
       
    64 // ---------------------------------------------------------
       
    65 //
       
    66 CMemSpyServerSession::~CMemSpyServerSession()
       
    67     {
       
    68 #ifdef _DEBUG
       
    69     TPtrC pThreadName( KNullDesC );
       
    70     if  ( iClientThreadName )
       
    71         {
       
    72         pThreadName.Set( *iClientThreadName );
       
    73         }
       
    74 
       
    75     RDebug::Print( _L("[MemSpy] CMemSpyServerSession::~CMemSpyServerSession() - DEAD SESSION - this: 0x%08x, id: %4d, name: %S"), this, iClientThreadId, iClientThreadName );
       
    76 #endif
       
    77 
       
    78     delete iClientThreadName;
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------
       
    82 // ConstructL( const RMessage2& aMessage )
       
    83 // ---------------------------------------------------------
       
    84 //
       
    85 void CMemSpyServerSession::ConstructL( const RMessage2& aMessage )
       
    86     {
       
    87 	RThread thread;
       
    88     const TInt error = aMessage.Client( thread );
       
    89     CleanupClosePushL( thread );
       
    90 
       
    91     TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::ConstructL() - this: 0x%08x - opening client thread - err: %d", this, error ) );
       
    92 
       
    93     User::LeaveIfError( error );
       
    94 
       
    95     const TFullName threadName( thread.FullName() );
       
    96     iClientThreadName = threadName.AllocL();
       
    97     iClientThreadId = thread.Id();
       
    98 
       
    99     CleanupStack::PopAndDestroy( &thread );
       
   100 
       
   101     TRACE( RDebug::Print( _L("[MemSpy] CMemSpyServerSession::ConstructL() - NEW SESSION - this: 0x%08x, id: %4d, client: %S"), this, iClientThreadId, iClientThreadName ) );
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // NewL( CMemSpyEngine& aEngine, const RMessage2& aMessage )
       
   106 // Two-phased constructor
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 CMemSpyServerSession* CMemSpyServerSession::NewL( CMemSpyEngine& aEngine, const RMessage2& aMessage )
       
   110     {
       
   111     CMemSpyServerSession* self = new(ELeave) CMemSpyServerSession( aEngine );
       
   112     CleanupStack::PushL( self );
       
   113     self->ConstructL( aMessage );
       
   114     CleanupStack::Pop( self );
       
   115     return self;
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------
       
   119 // ServiceL( const RMessage2& aMessage )
       
   120 // Method from which the clients request arrives
       
   121 // ---------------------------------------------------------
       
   122 //
       
   123 void CMemSpyServerSession::ServiceL( const RMessage2& aMessage )
       
   124     {
       
   125     TRACE( RDebug::Print( _L("[MemSpy] CMemSpyServerSession::ServiceL() - START - this: 0x%08x, fn: 0x%08x, id: %4d, client: %S"), this, aMessage.Function(), iClientThreadId, iClientThreadName ) );   
       
   126     
       
   127     TRAPD( error, DoServiceL( aMessage ) );
       
   128     if  ( error != KErrNone )
       
   129         {
       
   130         RDebug::Print( _L("[MemSpy] CMemSpyServerSession::ServiceL() - SERVICE ERROR - this: 0x%08x, fn: %d, err: %d, client: %S"), this, aMessage.Function(), error, iClientThreadName );
       
   131         }
       
   132     aMessage.Complete( error );
       
   133 
       
   134     TRACE( RDebug::Print( _L("[MemSpy] CMemSpyServerSession::ServiceL() - END - this: 0x%08x, fn: 0x%08x, id: %4d, client: %S"), this, aMessage.Function(), iClientThreadId, iClientThreadName ) );
       
   135 	}
       
   136 
       
   137 // ---------------------------------------------------------
       
   138 // DoCmdServiceL( const RMessage2& aMessage )
       
   139 // ---------------------------------------------------------
       
   140 //
       
   141 void CMemSpyServerSession::DoCmdServiceL( const RMessage2& aMessage )
       
   142     {
       
   143     TInt error = KErrNone;
       
   144 
       
   145     // Check function attributes
       
   146     const TInt function = aMessage.Function() & KMemSpyOpFlagsTypeMask;    
       
   147     const TInt argSpec = aMessage.Function() & KMemSpyOpFlagsInclusionMask;
       
   148     const TBool byThreadId = ( argSpec == KMemSpyOpFlagsIncludesThreadId );
       
   149     const TBool byThreadName = ( argSpec == KMemSpyOpFlagsIncludesThreadName );
       
   150 
       
   151     TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::DoServiceL() - START - unmodified function: 0x%08x, opCode: %d [TID: %d, TN: %d]", aMessage.Function(), function, byThreadId, byThreadName ) );   
       
   152     
       
   153     switch (function)
       
   154     	{
       
   155 		case EGetProcessCount:
       
   156 			{
       
   157 			aMessage.WriteL(0, TPckgBuf<TInt>(iEngine.Container().Count()));
       
   158 			break;
       
   159 			}
       
   160 		case EGetProcesses:
       
   161 			{
       
   162 			CMemSpyEngineObjectContainer& list = iEngine.Container();
       
   163 			
       
   164 			TPckgBuf<TInt> a0;
       
   165 			aMessage.ReadL(0, a0);
       
   166 			TInt realCount = Min(a0(), list.Count());
       
   167 			
       
   168 			for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyProcessData))
       
   169 				{
       
   170 				CMemSpyProcess& process = iEngine.Container().At(i);
       
   171 				TMemSpyProcessData data;
       
   172 				data.iId = process.Id();
       
   173 				data.iName.Copy(process.Name());
       
   174 				
       
   175 				TPckgBuf<TMemSpyProcessData> buffer(data);
       
   176 				aMessage.WriteL(1, buffer, offset);
       
   177 				}
       
   178 			
       
   179 			a0 = list.Count();
       
   180 			aMessage.WriteL(0, a0);
       
   181 
       
   182 			break;
       
   183 			}
       
   184 		case EProcessSystemPermanentOrCritical:
       
   185 			{
       
   186 			TBool ret = EFalse;
       
   187 			TPckgBuf<TProcessId> id;
       
   188 			aMessage.ReadL( 0, id );
       
   189 			
       
   190 			CMemSpyEngineObjectContainer& container = iEngine.Container();
       
   191 			CMemSpyProcess& process = container.ProcessByIdL( id() );
       
   192 			
       
   193 			process.Open();
       
   194 
       
   195 			if  ( process.IsSystemPermanent() || process.IsSystemCritical() )
       
   196 				{
       
   197 				ret = ETrue;
       
   198 				}
       
   199 			TPckgBuf<TBool> retBuf( ret );
       
   200 			aMessage.WriteL( 1, retBuf );
       
   201 			
       
   202 			break;
       
   203 			}
       
   204 		case EEndProcess:
       
   205 			{
       
   206 			TPckgBuf<TProcessId> id;
       
   207 			aMessage.ReadL( 0, id );
       
   208 			TPckgBuf<TEndType> type;
       
   209 			aMessage.ReadL( 1, type );
       
   210 					
       
   211 			CMemSpyEngineObjectContainer& container = iEngine.Container();			
       
   212 			CMemSpyProcess& process = container.ProcessByIdL( id() );
       
   213 									
       
   214 			switch ( type() )
       
   215 				{
       
   216 				case ETerminate:
       
   217 					{
       
   218 					process.TerminateL();
       
   219 					break;
       
   220 					}
       
   221 				case EPanic:
       
   222 					{
       
   223 					process.PanicL();
       
   224 					break;
       
   225 					}
       
   226 				case EKill:
       
   227 					{
       
   228 					process.KillL();
       
   229 					break;
       
   230 					}
       
   231 				}																
       
   232 			break;
       
   233 			}
       
   234 		case ESwitchToProcess:
       
   235 			{/*
       
   236 		    TInt wgCount;
       
   237 		    RWsSession wsSession;
       
   238 		    User::LeaveIfError( wsSession.Connect() );
       
   239 		    CleanupClosePushL( wsSession );
       
   240 		    User::LeaveIfError( wgCount = wsSession.NumWindowGroups() );
       
   241 		    RArray<RWsSession::TWindowGroupChainInfo> wgArray;
       
   242 		    CleanupClosePushL( wgArray );
       
   243 		    User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
       
   244 		    TApaTask task( wsSession );
       
   245 		    TBool brought( EFalse );
       
   246 		    TInt wgId( KErrNotFound );
       
   247 		    TThreadId threadId;
       
   248 			
       
   249 			TPckgBuf<TProcessId> id;
       
   250 			aMessage.ReadL( 0, id );
       
   251 			CMemSpyEngineObjectContainer& container = iEngine.Container();
       
   252 			CMemSpyProcess& process = container.ProcessByIdL( id() );
       
   253 			
       
   254 			// loop trough threads in a process
       
   255 			for ( TInt i = 0; i < process.MdcaCount(); i++ )
       
   256 				{
       
   257 				TInt wgCountLocal = wgCount;
       
   258 			                
       
   259 				// loop trough all window groups and see if a thread id matches
       
   260 				while( !brought && wgCountLocal-- )
       
   261 					{
       
   262 					wgId = wgArray[wgCountLocal].iId;
       
   263 					User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
       
   264 					if ( threadId == process.At( i ).Id() )
       
   265 						{
       
   266 						CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
       
   267 						task.SetWgId( wgId );
       
   268 						if ( !wgName->Hidden() && task.Exists() )
       
   269 							{
       
   270 							task.BringToForeground();
       
   271 							brought = ETrue;                        
       
   272 							}
       
   273 						CleanupStack::PopAndDestroy( wgName );
       
   274 						}
       
   275 					}
       
   276 				}
       
   277 			
       
   278 			TPckgBuf<TBool> ret( brought );
       
   279 			aMessage.WriteL( 1, ret );
       
   280 			
       
   281 			break;*/
       
   282 			}
       
   283 		case EGetThreadCount:
       
   284 			{
       
   285 			TPckgBuf<TProcessId> pid;
       
   286 			aMessage.ReadL(1, pid);
       
   287 			CMemSpyProcess& process = iEngine.Container().ProcessByIdL(pid());
       
   288 			process.Open();
       
   289 			aMessage.WriteL(0, TPckgBuf<TInt>(process.Count()));
       
   290 			process.Close();
       
   291 			break;
       
   292 			}
       
   293 		case EGetThreads:
       
   294 			{
       
   295 			TPckgBuf<TProcessId> pid;
       
   296 			aMessage.ReadL(2, pid);
       
   297 			
       
   298 			CMemSpyProcess& list = iEngine.Container().ProcessByIdL(pid());
       
   299 			list.Open();
       
   300 			
       
   301 			TPckgBuf<TInt> a0;
       
   302 			aMessage.ReadL(0, a0);
       
   303 			TInt realCount = Min(a0(), list.Count());
       
   304 			
       
   305 			for(TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyThreadData))
       
   306 				{
       
   307 				CMemSpyThread& thread = list.At(i);
       
   308 				thread.Open();
       
   309 				
       
   310 				TMemSpyThreadData data;
       
   311 				data.iId = thread.Id();
       
   312 				data.iName.Copy(thread.Name());
       
   313 				data.iThreadPriority = thread.Priority();
       
   314 				
       
   315 				TPckgBuf<TMemSpyThreadData> buffer(data);
       
   316 				aMessage.WriteL(1, buffer, offset);
       
   317 				
       
   318 				thread.Close();
       
   319 				}
       
   320 			
       
   321 			a0 = list.Count();
       
   322 			aMessage.WriteL(0, a0);
       
   323 			
       
   324 			list.Close();
       
   325 
       
   326 			break;
       
   327 			}
       
   328 		case ESetThreadPriority:
       
   329 			{
       
   330 			TPckgBuf<TThreadId> tid;
       
   331 			TPckgBuf<TInt> priority;
       
   332 			aMessage.ReadL(0, tid);
       
   333 			aMessage.ReadL(1, priority);
       
   334 			
       
   335 			CMemSpyProcess* process = NULL;
       
   336 			CMemSpyThread* thread = NULL; 
       
   337 			User::LeaveIfError(iEngine.Container().ProcessAndThreadByThreadId(tid(), process, thread));
       
   338 			
       
   339 			if (thread)
       
   340 				{				
       
   341 				thread->Open();
       
   342 				thread->SetPriorityL(static_cast<TThreadPriority>(priority()));				
       
   343 				thread->Close();
       
   344 				}					
       
   345 			break;
       
   346 			}
       
   347 		case EThreadSystemPermanentOrCritical:
       
   348 			{
       
   349 			TBool ret = EFalse;
       
   350 			TPckgBuf<TThreadId> id;
       
   351 			aMessage.ReadL( 0, id );
       
   352 			
       
   353 			CMemSpyEngineObjectContainer& container = iEngine.Container();            
       
   354             CMemSpyProcess* process = NULL;
       
   355             CMemSpyThread* thread = NULL; 
       
   356             User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
       
   357             
       
   358             if ( thread )
       
   359             	{				
       
   360 				thread->Open();
       
   361 				
       
   362 				if  ( thread->IsSystemPermanent() || thread->IsSystemCritical() )
       
   363 					{			
       
   364 					ret = ETrue;					
       
   365 					}
       
   366 				thread->Close();
       
   367             	}
       
   368             TPckgBuf<TBool> retBuf( ret );
       
   369             aMessage.WriteL( 1, retBuf );
       
   370             				
       
   371 			break;
       
   372 			}
       
   373 		case EEndThread:
       
   374 			{
       
   375 			TPckgBuf<TThreadId> id;
       
   376 			aMessage.ReadL( 0, id );
       
   377 			TPckgBuf<TEndType> type;
       
   378 			aMessage.ReadL( 1, type );
       
   379 			
       
   380 			CMemSpyEngineObjectContainer& container = iEngine.Container();
       
   381 			CMemSpyProcess* process = NULL;
       
   382 			CMemSpyThread* thread = NULL; 
       
   383 			User::LeaveIfError( container.ProcessAndThreadByThreadId( id(), process, thread ) );
       
   384 			
       
   385 			if( thread )
       
   386 				{
       
   387 				switch ( type() )
       
   388 					{
       
   389 					case ETerminate:
       
   390 						{
       
   391 						thread->TerminateL();
       
   392 						break;
       
   393 						}
       
   394 					case EPanic:
       
   395 						{
       
   396 						thread->PanicL();
       
   397 						break;
       
   398 						}
       
   399 					case EKill:
       
   400 						{
       
   401 						thread->KillL();
       
   402 						break;
       
   403 						}
       
   404 					}				
       
   405 				}			
       
   406 			break;
       
   407 			}
       
   408 		// --- KernelObjects related functions ---
       
   409 		case EGetKernelObjectTypeCount:
       
   410 			{
       
   411 			TInt iCount = EMemSpyDriverContainerTypeLast - EMemSpyDriverContainerTypeFirst;
       
   412 			TPckgBuf<TInt> ret( iCount );
       
   413 			aMessage.WriteL(0, ret);			
       
   414 			break;
       
   415 			}
       
   416 		case EGetKernelObjects:
       
   417 			{
       
   418 			TPckgBuf<TInt> count;
       
   419 			aMessage.ReadL(0, count);
       
   420 			
       
   421 			CMemSpyEngineGenericKernelObjectContainer* model = iEngine.HelperKernelContainers().ObjectsAllL(); //contains all the objects
       
   422 			CleanupStack::PushL( model );
       
   423 			
       
   424 			for( TInt i=0, offset = 0; i<count(); i++, offset += sizeof( TMemSpyKernelObjectData ) )
       
   425 				{
       
   426 				TMemSpyKernelObjectData data;
       
   427 				
       
   428 				TPtrC name(model->At(i).Name().Mid(1));
       
   429 				TInt tabPos = name.Locate('\t');
       
   430 				if (tabPos != KErrNotFound)
       
   431 					name.Set(name.Left(tabPos));
       
   432 												
       
   433 				data.iName.Copy(name);
       
   434 				data.iType = model->At(i).Type();
       
   435 				data.iCount = model->At(i).Count();											
       
   436 				data.iSize = model->At(i).Count() * model->At(i).Count();
       
   437 
       
   438 				TPckgBuf<TMemSpyKernelObjectData> buffer(data);
       
   439 				aMessage.WriteL(1, buffer, offset);
       
   440 				}			
       
   441 			aMessage.WriteL(0, count);
       
   442 			CleanupStack::PopAndDestroy( model );
       
   443 			break;
       
   444 			}
       
   445 		case EGetKernelObjectItemsCount:
       
   446 			{
       
   447 			TPckgBuf<TMemSpyDriverContainerType> tempType;
       
   448 			aMessage.ReadL(1, tempType); //get type of kernel object
       
   449 			TMemSpyDriverContainerType type = tempType();
       
   450 			
       
   451 			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
       
   452 			CMemSpyEngineGenericKernelObjectList* iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( type );
       
   453 			CleanupStack::PushL( iObjectList );
       
   454 			
       
   455 			TInt count = iObjectList->Count();
       
   456 			TPckgBuf<TInt> ret( count );
       
   457 			aMessage.WriteL( 0, ret );
       
   458 			
       
   459 			CleanupStack::PopAndDestroy( iObjectList );
       
   460 			break;
       
   461 			}
       
   462 		case EGetKernelObjectItems:
       
   463 			{
       
   464 			TPckgBuf<TInt> count;
       
   465 			TPckgBuf<TMemSpyDriverContainerType> tempType;
       
   466 			aMessage.ReadL( 0, count ); //get count of items
       
   467 			aMessage.ReadL(1, tempType); //get type of kernel object
       
   468 			TInt c = count();
       
   469 			
       
   470 			CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
       
   471 			CMemSpyEngineGenericKernelObjectList* iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( tempType() );
       
   472 			CleanupStack::PushL( iObjectList );
       
   473 			
       
   474 			for( TInt i=0, offset = 0; i<c; i++, offset += sizeof( TMemSpyDriverHandleInfoGeneric ) )
       
   475 				{
       
   476 				TMemSpyDriverHandleInfoGeneric data;								
       
   477 															
       
   478 				data = iObjectList->At( i );
       
   479 				
       
   480 				TPckgBuf<TMemSpyDriverHandleInfoGeneric> buffer(data);
       
   481 				aMessage.WriteL(2, buffer, offset);
       
   482 				}			
       
   483 			
       
   484 			CleanupStack::PopAndDestroy( iObjectList );			
       
   485 			break;
       
   486 			}
       
   487 		// --- Kernel Heap related functions ---
       
   488 		case EGetHeap:
       
   489 			{
       
   490 			TMemSpyHeapInfo heapInfo;			
       
   491 			iEngine.HelperHeap().GetHeapInfoKernelL( heapInfo );
       
   492 			TMemSpyHeapData data = iEngine.HelperHeap().NewHeapRawInfo( heapInfo );
       
   493 			
       
   494 			TPckgBuf<TMemSpyHeapData> buffer(data);
       
   495 			aMessage.WriteL(0, buffer);
       
   496 			
       
   497 			break;
       
   498 			}
       
   499     	}
       
   500 //    else if( function == EProcessByIndex )
       
   501 //    	{
       
   502 //		TMemSpyProcess iProcess;
       
   503 //		TInt in;
       
   504 //		TPckgBuf<TInt> index( in );
       
   505 //		aMessage.ReadL( 0, index );
       
   506 //		CMemSpyProcess& process = iEngine.Container().At( index() );
       
   507 //		//fill the data structure
       
   508 //		iProcess.iId = process.Id(); //process ID
       
   509 //		iProcess.iName.Append( process.Name() ); //raw process name
       
   510 //		iProcess.iThreadCount = process.Count(); //thread count
       
   511 //		iProcess.iPriority = process.Priority();
       
   512 //		//			
       
   513 //		TPckgBuf<TMemSpyProcess> buf( iProcess );
       
   514 //		aMessage.WriteL( 1, buf );
       
   515 //		aMessage.Complete( KErrNone );
       
   516 //    	}
       
   517 //    else if( function == EProcessIndexById )
       
   518 //    	{
       
   519 //		TProcessId iId;
       
   520 //		TPckgBuf<TProcessId> buf( iId );
       
   521 //    	aMessage.ReadL( 0, buf );
       
   522 //    	TInt index = iEngine.Container().ProcessIndexById( buf() );
       
   523 //    	TPckgBuf<TInt> out( index );
       
   524 //    	aMessage.WriteL( 1, out );
       
   525 //    	aMessage.Complete( KErrNone );
       
   526 //    	}
       
   527 //    else if( function == EOutputProcessInfo )
       
   528 //    	{
       
   529 //		TProcessId iId;
       
   530 //		TPckgBuf<TProcessId> buf( iId );
       
   531 //		aMessage.ReadL( 0, buf );
       
   532 //		CMemSpyProcess& process = iEngine.Container().ProcessByIdL( buf() );
       
   533 //		iEngine.HelperProcess().OutputProcessInfoL( process );
       
   534 //    	}
       
   535 //    else if( function == EProcessIsDead )
       
   536 //    	{
       
   537 //		TProcessId iId;
       
   538 //		TPckgBuf<TProcessId> buf( iId );
       
   539 //		aMessage.ReadL( 0, buf );
       
   540 //		CMemSpyProcess& process = iEngine.Container().ProcessByIdL( buf() );
       
   541 //		TBool dead = process.IsDead();
       
   542 //		TPckgBuf<TBool> out( dead );
       
   543 //		aMessage.WriteL( 1, out );
       
   544 //		aMessage.Complete( KErrNone );
       
   545 //    	}
       
   546 //    else if( function == ESortProcessesBy )
       
   547 //    	{
       
   548 //		TSortType type;
       
   549 //		TPckgBuf<TSortType> buf(type);
       
   550 //		aMessage.ReadL( 0, buf );
       
   551 //		if( buf() == ESortProcById )
       
   552 //			{
       
   553 //			iEngine.Container().SortById();
       
   554 //			}
       
   555 //		else if( buf() == ESortProcByName )
       
   556 //			{
       
   557 //			iEngine.Container().SortByName();
       
   558 //			}
       
   559 //		else if( buf() == ESortProcByThreadCount )
       
   560 //			{
       
   561 //			iEngine.Container().SortByThreadCount();
       
   562 //			}
       
   563 //		else if( buf() == ESortProcByCodeSegs )
       
   564 //			{
       
   565 //			iEngine.Container().SortByCodeSegs();
       
   566 //			}
       
   567 //		else if( buf() == ESortProcByHeapUsage )
       
   568 //			{
       
   569 //			iEngine.Container().SortByHeapUsage();			
       
   570 //			}
       
   571 //		else if( buf() == ESortProcByStackUsage )
       
   572 //			{
       
   573 //			iEngine.Container().SortByStackUsage();
       
   574 //			}			
       
   575 //    	}
       
   576 //    else if( function == EOpenCloseCurrentProcess )
       
   577 //    	{
       
   578 //		TProcessId id;
       
   579 //		TBool open;
       
   580 //    	TPckgBuf<TProcessId> buf(id);
       
   581 //    	TPckgBuf<TBool> buf2(open);
       
   582 //    	aMessage.ReadL( 0, buf );
       
   583 //    	aMessage.ReadL( 1, buf2 );
       
   584 //    	if( buf2() == 1 )
       
   585 //    		{
       
   586 //			iEngine.Container().ProcessByIdL( buf() ).Open();
       
   587 //    		}
       
   588 //    	else
       
   589 //    		{
       
   590 //			iEngine.Container().ProcessByIdL( buf() ).Close();
       
   591 //    		}
       
   592 //    	}
       
   593     
       
   594 //    // Check function is supported and argument combination is valid
       
   595 //    error = ValidateFunction( function, byThreadId, byThreadName );
       
   596 //    TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::DoServiceL() - validation result: %d", error ) );
       
   597 //    
       
   598 //    // Process function request
       
   599 //    if  ( error == KErrNone )
       
   600 //        {
       
   601 //        if  ( byThreadId )
       
   602 //            {
       
   603 //            TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::DoServiceL() - [TID] thread-specific..." ) );
       
   604 //            
       
   605 //            const TThreadId threadId( aMessage.Int0() );
       
   606 //            HandleThreadSpecificOpL( function, threadId );
       
   607 //            }
       
   608 //        else if ( byThreadName )
       
   609 //            {
       
   610 //            TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::DoServiceL() - [TN] thread-specific..." ) );
       
   611 //
       
   612 //            error = aMessage.GetDesLength( 0 /*slot 0*/ );
       
   613 //        
       
   614 //            if  ( error > 0 && error <= KMaxFullName )
       
   615 //                {
       
   616 //                TFullName* threadName = new(ELeave) TFullName();
       
   617 //                CleanupStack::PushL( threadName );
       
   618 //                aMessage.ReadL( 0, *threadName );
       
   619 //                HandleThreadSpecificOpL( function, *threadName );
       
   620 //                CleanupStack::PopAndDestroy( threadName );
       
   621 //                }
       
   622 //            else
       
   623 //                {
       
   624 //                error = KErrArgument;
       
   625 //                }
       
   626 //            }
       
   627 //        else
       
   628 //            {
       
   629 //            TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::DoServiceL() - thread-agnostic..." ) );
       
   630 //
       
   631 //            HandleThreadAgnosticOpL( function, aMessage );
       
   632 //            }
       
   633 //        }
       
   634 
       
   635     User::LeaveIfError( error );
       
   636 
       
   637     TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::DoServiceL() - HELLOOOOOO" ) );
       
   638     TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::DoServiceL() - END" ) );
       
   639     }
       
   640 
       
   641 // ---------------------------------------------------------
       
   642 // ValidateFunction( TInt aFunction, TBool aIncludesThreadId, TBool aIncludesThreadName )
       
   643 // Validates the MemSpy operation types
       
   644 // ---------------------------------------------------------
       
   645 //
       
   646 TInt CMemSpyServerSession::ValidateFunction( TInt aFunction, TBool aIncludesThreadId, TBool aIncludesThreadName )
       
   647     {
       
   648     TInt err = KErrNotSupported;
       
   649     
       
   650     // Check the operation is within op-code range
       
   651     if  ( aFunction >= EMemSpyClientServerOpMarkerFirst && aFunction < EMemSpyClientServerOpMarkerLast )
       
   652         {
       
   653         // Check the operation doesn't include unnecessary or not supported information
       
   654         const TBool includesThreadIdentifier = ( aIncludesThreadId || aIncludesThreadName );
       
   655         if  ( includesThreadIdentifier && aFunction >= EMemSpyClientServerOpMarkerThreadAgnosticFirst )
       
   656             {
       
   657             // Passing a thread identifier to a thread agnostic operation
       
   658             err = KErrArgument;
       
   659             }
       
   660         else
       
   661             {
       
   662             err = KErrNone;
       
   663             }
       
   664         }
       
   665     //
       
   666     if  ( err != KErrNone )
       
   667         {
       
   668         RDebug::Printf( "[MemSpy] CMemSpyServerSession::ValidateFunction() - function request did not validate - [withId: %d, withName: %d]", aIncludesThreadId, aIncludesThreadName );
       
   669         }
       
   670     //
       
   671     return err;
       
   672     }
       
   673 
       
   674 // ---------------------------------------------------------
       
   675 // HandleThreadSpecificOpL( TInt aFunction, const TThreadId& aThreadId )
       
   676 // ---------------------------------------------------------
       
   677 //
       
   678 void CMemSpyServerSession::HandleThreadSpecificOpL( TInt aFunction, const TThreadId& aThreadId )
       
   679     {
       
   680 //    TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - START - aFunction: %d, aThreadId: %d", aFunction, (TUint) aThreadId ) );
       
   681 //
       
   682 //    ASSERT( (TUint) aThreadId != 0 );
       
   683 //    TInt error = KErrNone;
       
   684 //
       
   685 //    // Check if its a kernel thread identifier
       
   686 //    const TBool isKernel = ( static_cast<TUint32>( aThreadId ) == KMemSpyClientServerThreadIdKernel );
       
   687 //
       
   688 //    // Treat as thread specific operation
       
   689 //    CMemSpyProcess* process = NULL;
       
   690 //    CMemSpyThread* thread = NULL;
       
   691 //    if  ( !isKernel )
       
   692 //        {
       
   693 //        error = iEngine.Container().ProcessAndThreadByThreadId( aThreadId, process, thread );
       
   694 //        TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - search result: %d, proc: 0x%08x, thread: 0x%08x", error, process, thread ) );
       
   695 //        }
       
   696 //    else
       
   697 //        {
       
   698 //        // Kernel is only supported for a couple of operations
       
   699 //        if  ( aFunction == EMemSpyClientServerOpHeapInfo || aFunction == EMemSpyClientServerOpHeapData )
       
   700 //            {
       
   701 //            }
       
   702 //        else
       
   703 //            {
       
   704 //            TRACE( RDebug::Printf( "[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - trying to call unsupported function for kernel thread!" ) );
       
   705 //            error = KErrArgument;
       
   706 //            }
       
   707 //        }
       
   708 //
       
   709 //    // Must be no error so far and we must have a valid thread & process when performing a non-kernel op
       
   710 //    // or then if we are performing a kernel op, we don't need the thread or process.
       
   711 //    if  ( error == KErrNone && ( ( thread && process && !isKernel ) || ( isKernel ) ) )
       
   712 //        {
       
   713 //#ifdef _DEBUG
       
   714 //        if  ( thread )
       
   715 //            {
       
   716 //            HBufC* threadName = thread->FullName().AllocLC();
       
   717 //            _LIT( KTrace2, "[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - thread: %S" );
       
   718 //            RDebug::Print( KTrace2, threadName );
       
   719 //            CleanupStack::PopAndDestroy( threadName );
       
   720 //            }
       
   721 //        else if ( isKernel )
       
   722 //            {
       
   723 //            _LIT( KTrace2, "[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - thread: Kernel" );
       
   724 //            RDebug::Print( KTrace2 );
       
   725 //            }
       
   726 //#endif
       
   727 //
       
   728 //        // Got a valid thread object - now work out which operation to perform...
       
   729 //        switch( aFunction )
       
   730 //            {
       
   731 //        case EMemSpyClientServerOpSummaryInfo:
       
   732 //            iEngine.HelperProcess().OutputProcessInfoL( *process );
       
   733 //            break;
       
   734 //        case EMemSpyClientServerOpSummaryInfoDetailed:
       
   735 //            iEngine.HelperProcess().OutputProcessInfoDetailedL( *process );
       
   736 //            break;
       
   737 //        case EMemSpyClientServerOpHeapInfo:
       
   738 //            if  ( isKernel )
       
   739 //                {
       
   740 //                iEngine.HelperHeap().OutputHeapInfoKernelL();
       
   741 //                }
       
   742 //            else
       
   743 //                {
       
   744 //                iEngine.HelperHeap().OutputHeapInfoUserL( *thread );
       
   745 //                }
       
   746 //            break;
       
   747 //        case EMemSpyClientServerOpHeapCellListing:
       
   748 //            iEngine.HelperHeap().OutputCellListingUserL( *thread );
       
   749 //            break;
       
   750 //        case EMemSpyClientServerOpHeapData:
       
   751 //            if  ( isKernel )
       
   752 //                {
       
   753 //                iEngine.HelperHeap().OutputHeapDataKernelL();
       
   754 //                }
       
   755 //            else
       
   756 //                {
       
   757 //                iEngine.HelperHeap().OutputHeapDataUserL( *thread );
       
   758 //                }
       
   759 //            break;
       
   760 //        case EMemSpyClientServerOpStackInfo:
       
   761 //            iEngine.HelperStack().OutputStackInfoL( *thread );
       
   762 //            break;
       
   763 //        case EMemSpyClientServerOpStackDataUser:
       
   764 //            iEngine.HelperStack().OutputStackDataL( *thread, EMemSpyDriverDomainUser, EFalse );
       
   765 //            break;
       
   766 //        case EMemSpyClientServerOpStackDataKernel:
       
   767 //            iEngine.HelperStack().OutputStackDataL( *thread, EMemSpyDriverDomainKernel, EFalse );
       
   768 //            break;
       
   769 //        case EMemSpyClientServerOpOpenFiles:
       
   770 //            iEngine.HelperFileSystem().ListOpenFilesL( aThreadId );
       
   771 //            break;
       
   772 //
       
   773 //        default:
       
   774 //            error = KErrNotSupported;
       
   775 //            break;
       
   776 //            }
       
   777 //        }
       
   778 //
       
   779 //    TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - END - aFunction: %d, aThreadId: %d, error: %d", aFunction, (TUint) aThreadId, error ) );
       
   780 //    User::LeaveIfError( error );
       
   781     }
       
   782 
       
   783 // ---------------------------------------------------------
       
   784 // HandleThreadSpecificOpL( TInt aFunction, const TDesC& aThreadName )
       
   785 // Gets thread ID from aThreadName 
       
   786 // and calls HandleThreadSpecificOpL( , const TThreadId& aThreadId )
       
   787 // ---------------------------------------------------------
       
   788 //
       
   789 void CMemSpyServerSession::HandleThreadSpecificOpL( TInt aFunction, const TDesC& aThreadName )
       
   790     {
       
   791 //    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - START - aFunction: %d, aThreadName: %S"), aFunction, &aThreadName ) );
       
   792 //    //
       
   793 //    CMemSpyProcess* process = NULL;
       
   794 //    CMemSpyThread* thread = NULL;
       
   795 //    TInt error = iEngine.Container().ProcessAndThreadByPartialName( aThreadName, process, thread );
       
   796 //    User::LeaveIfError( error );
       
   797 //    //
       
   798 //    const TThreadId threadId( thread->Id() );
       
   799 //    HandleThreadSpecificOpL( aFunction, threadId );
       
   800 //    //
       
   801 //    TRACE( RDebug::Print( _L("[MemSpy] CMemSpyServerSession::HandleThreadSpecificOpL() - END - aFunction: %d, aThreadName: %S"), aFunction, &aThreadName ) );
       
   802     }
       
   803 
       
   804 // ---------------------------------------------------------
       
   805 // HandleThreadAgnosticOpL( TInt aFunction, const RMessage2& aMessage )
       
   806 // ---------------------------------------------------------
       
   807 //
       
   808 void CMemSpyServerSession::HandleThreadAgnosticOpL( TInt aFunction, const RMessage2& aMessage )
       
   809     {
       
   810 //    TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - START" ) );
       
   811 //    //
       
   812 //    if  ( aFunction ==  EMemSpyClientServerOpHeapInfoCompact )
       
   813 //        {
       
   814 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpHeapInfoCompact") );
       
   815 //        iEngine.HelperHeap().OutputHeapInfoForDeviceL();
       
   816 //        }
       
   817 //    else if ( aFunction ==  EMemSpyClientServerOpStackInfoCompact )
       
   818 //        {
       
   819 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpStackInfoCompact") );
       
   820 //        iEngine.HelperStack().OutputStackInfoForDeviceL();
       
   821 //        }
       
   822 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart )
       
   823 //        {
       
   824 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart") );
       
   825 //        iEngine.HelperSysMemTracker().StartL();
       
   826 //        }
       
   827 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop )
       
   828 //        {
       
   829 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop") );
       
   830 //        iEngine.HelperSysMemTracker().StopL();
       
   831 //        }
       
   832 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingReset )
       
   833 //        {
       
   834 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingReset") );
       
   835 //        iEngine.HelperSysMemTracker().Reset();
       
   836 //        }
       
   837 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate )
       
   838 //        {
       
   839 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate") );
       
   840 //        iEngine.HelperSysMemTracker().CheckForChangesNowL();
       
   841 //        }
       
   842 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet )
       
   843 //        {
       
   844 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet") );
       
   845 //        
       
   846 //        // Get current config
       
   847 //        TMemSpyEngineHelperSysMemTrackerConfig config;
       
   848 //        iEngine.HelperSysMemTracker().GetConfig( config );
       
   849 //
       
   850 //        // Set new timer value
       
   851 //        config.iTimerPeriod = aMessage.Int0();
       
   852 //
       
   853 //        // And update config... which will leave if the config is invalid
       
   854 //        iEngine.HelperSysMemTracker().SetConfigL( config );
       
   855 //        }
       
   856 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet )
       
   857 //        {
       
   858 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet") );
       
   859 //        // Get current config
       
   860 //        TMemSpyEngineHelperSysMemTrackerConfig config;
       
   861 //        iEngine.HelperSysMemTracker().GetConfig( config );
       
   862 //
       
   863 //        // Set new categories
       
   864 //        config.iEnabledCategories = aMessage.Int0();
       
   865 //
       
   866 //        // And update config... which will leave if the config is invalid
       
   867 //        iEngine.HelperSysMemTracker().SetConfigL( config );
       
   868 //        }
       
   869 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet )
       
   870 //        {
       
   871 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet") );
       
   872 //        // Get current config
       
   873 //        TMemSpyEngineHelperSysMemTrackerConfig config;
       
   874 //        iEngine.HelperSysMemTracker().GetConfig( config );
       
   875 //
       
   876 //        // Set new filter
       
   877 //        RBuf buf;
       
   878 //        buf.CleanupClosePushL();
       
   879 //        TInt len = aMessage.GetDesLength( 0 );
       
   880 //        if ( len > 0 )
       
   881 //            {
       
   882 //            buf.CreateL( len );
       
   883 //            aMessage.ReadL( 0, buf, 0 );
       
   884 //            config.iThreadNameFilter.Copy( buf );            
       
   885 //            }
       
   886 //        else
       
   887 //            {
       
   888 //            config.iThreadNameFilter.Zero();
       
   889 //            }
       
   890 //        CleanupStack::PopAndDestroy( &buf );
       
   891 //
       
   892 //        // And update config... which will leave if the config is invalid
       
   893 //        iEngine.HelperSysMemTracker().SetConfigL( config );
       
   894 //        }
       
   895 //    else if ( aFunction == EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet )
       
   896 //        {
       
   897 //        // Get current config
       
   898 //        TMemSpyEngineHelperSysMemTrackerConfig config;
       
   899 //        iEngine.HelperSysMemTracker().GetConfig( config );
       
   900 //        
       
   901 //        // Set new Heap Dump value
       
   902 //        config.iDumpData = aMessage.Int0();
       
   903 //        
       
   904 //        // And update config... which will leave if the config is invalid
       
   905 //        iEngine.HelperSysMemTracker().SetConfigL( config );
       
   906 //        }
       
   907 //    else if ( aFunction == EMemSpyClientServerOpSwitchOutputSinkTrace )
       
   908 //        {
       
   909 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSwitchOutputSinkTrace") );
       
   910 //        iEngine.InstallSinkL( ESinkTypeDebug );
       
   911 //        }
       
   912 //    else if ( aFunction == EMemSpyClientServerOpSwitchOutputSinkFile )
       
   913 //        {
       
   914 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpSwitchOutputSinkFile") );
       
   915 //        iEngine.InstallSinkL( ESinkTypeFile );
       
   916 //        }
       
   917 //    else if ( aFunction == EMemSpyClientServerOpEnumerateKernelContainer )
       
   918 //        {
       
   919 //        const TMemSpyDriverContainerType type = CMemSpyEngineHelperKernelContainers::MapToType( static_cast< TObjectType >( aMessage.Int0() ) );
       
   920 //
       
   921 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpEnumerateKernelContainer - type: %d", type ) );
       
   922 //
       
   923 //        CMemSpyEngineGenericKernelObjectList* model = iEngine.HelperKernelContainers().ObjectsForSpecificContainerL( type );
       
   924 //        CleanupStack::PushL( model );
       
   925 //        model->OutputL( iEngine.Sink() );
       
   926 //        CleanupStack::PopAndDestroy( model );
       
   927 //        }
       
   928 //    else if ( aFunction == EMemSpyClientServerOpEnumerateKernelContainerAll )
       
   929 //        {
       
   930 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpEnumerateKernelContainerAll") );
       
   931 //        CMemSpyEngineGenericKernelObjectContainer* model = iEngine.HelperKernelContainers().ObjectsAllL();
       
   932 //        CleanupStack::PushL( model );
       
   933 //        model->OutputL( iEngine.Sink() );
       
   934 //        CleanupStack::PopAndDestroy( model );
       
   935 //        }
       
   936 //    else if ( aFunction == EMemSpyClientServerOpOpenFiles )
       
   937 //        {
       
   938 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpOpenFiles") );
       
   939 //        iEngine.ListOpenFilesL();
       
   940 //        }
       
   941 //    else if ( aFunction == EMemSpyClientServerOpDisableAknIconCache )
       
   942 //        {
       
   943 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - EMemSpyClientServerOpDisableAknIconCache") );
       
   944 //        iEngine.HelperRAM().SetAknIconCacheStatusL( EFalse );
       
   945 //        }
       
   946 //    else
       
   947 //        {
       
   948 //        TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - [device-wide operation] => invoking UI") );
       
   949 //        iEngine.NotifyClientServerOperationRequestL( aFunction );
       
   950 //        }
       
   951 //    //
       
   952 //    TRACE( RDebug::Printf("[MemSpy] CMemSpyServerSession::HandleThreadAgnosticOpL() - END" ) );
       
   953     }