perfsrv/memspy/MemSpyClient/src/memspysession.cpp
changeset 48 516af714ebb4
child 52 c2f44e33b468
equal deleted inserted replaced
45:185201be11b0 48:516af714ebb4
       
     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 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "memspysession.h"
       
    20 
       
    21 #include <memspyengineclientinterface.h>
       
    22 // API
       
    23 #include <memspy/engine/memspyprocessdata.h>
       
    24 #include <memspy/engine/memspythreaddata.h> 
       
    25 #include <memspy/engine/memspykernelobjectdata.h>
       
    26 #include <memspy/engine/memspyheapdata.h>
       
    27 #include <memspy/engine/memspymemorytrackingcycledata.h>
       
    28 //KernelObjects
       
    29 #include <memspy/driver/memspydriverenumerationsshared.h>
       
    30 // Servers
       
    31 #include <memspy/engine/memspyserverdata.h>
       
    32 // ECom
       
    33 #include <memspy/engine/memspyecomdata.h>
       
    34 
       
    35 // IMPLEMENTATION
       
    36 
       
    37 EXPORT_C RMemSpySession::RMemSpySession()
       
    38     {
       
    39     }
       
    40 
       
    41 
       
    42 EXPORT_C TInt RMemSpySession::Connect()
       
    43     {
       
    44 	TInt error(KErrNone);
       
    45 	
       
    46 	for (TInt i=0; i<2; i++) // Two retries max
       
    47 		{
       
    48 		TInt error = CreateSession(KMemSpyServerName, TVersion(KMemSpyVersion, 0, 0));
       
    49 		
       
    50 		if (error != KErrNotFound && error != KErrServerTerminated)
       
    51 			return error;
       
    52 		
       
    53 		error = StartServer();
       
    54 		
       
    55 		if (error != KErrNone && error != KErrAlreadyExists)
       
    56 			return error;
       
    57 		}
       
    58 	
       
    59 	return error;	
       
    60     }
       
    61 
       
    62 TInt RMemSpySession::StartServer()
       
    63 	{
       
    64 	RProcess server;
       
    65 	_LIT(KCommand, "start");
       
    66 	const TUid KServerUid3 = {0xE5883BC2};
       
    67 	TInt error = server.Create(KMemSpyServerName, KCommand);//, KServerUid3);
       
    68 	
       
    69 	if (error != KErrNone)
       
    70 		return error;
       
    71 	
       
    72 	TRequestStatus startStatus, stopStatus;
       
    73 	server.Logon(stopStatus);
       
    74 	if (stopStatus != KRequestPending)
       
    75 		{
       
    76 		User::WaitForRequest(stopStatus);
       
    77 		server.Kill(0);
       
    78 		server.Close();
       
    79 		return stopStatus.Int();
       
    80 		}
       
    81 	
       
    82 	server.Rendezvous(startStatus);
       
    83 	server.Resume();
       
    84 	User::WaitForRequest(startStatus, stopStatus);
       
    85 	if (startStatus == KRequestPending)
       
    86 		{
       
    87 		// not started yet, i.e. stopStatus was signaled
       
    88 		server.Close();
       
    89 		return stopStatus.Int();
       
    90 		}
       
    91 	
       
    92 	// Rendezvous was called - the server is ready
       
    93 	
       
    94 	// We first need to cancel Logon
       
    95 	server.LogonCancel(stopStatus);
       
    96 	// We don't need this anymore
       
    97 	server.Close();
       
    98 	// Wait for LogonCancel to complete
       
    99 	User::WaitForRequest(stopStatus);
       
   100 
       
   101 	// Everything went OK
       
   102 	return KErrNone;
       
   103 	}
       
   104 
       
   105 EXPORT_C void RMemSpySession::GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType)
       
   106 	{
       
   107 	TPckgBuf<TInt> count;
       
   108 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcessCount, TIpcArgs(&count)));
       
   109 	
       
   110 	TInt requestedCount = count();
       
   111 	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyProcessData));
       
   112 	TPtr8 bufferPtr(buffer->Des());
       
   113 	
       
   114 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetProcesses, TIpcArgs(&count, &bufferPtr)));
       
   115 	aProcesses.Reset();
       
   116 	
       
   117 	TInt receivedCount = Min(count(), requestedCount);
       
   118 	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyProcessData))
       
   119 		{
       
   120 		TPckgBuf<TMemSpyProcessData> data;
       
   121 		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyProcessData));
       
   122 		aProcesses.AppendL(CMemSpyApiProcess::NewLC(data()));
       
   123 		}
       
   124 	CleanupStack::Pop(aProcesses.Count());
       
   125 	CleanupStack::PopAndDestroy(buffer);
       
   126 	}
       
   127 
       
   128 EXPORT_C TProcessId RMemSpySession::GetProcessIdByNameL(const TDesC& aProcessName)
       
   129 	{
       
   130 	TPckgBuf<TProcessId> procId;
       
   131 	User::LeaveIfError(SendReceive(EMemSpyClienServerOpGetProcessIdByName, 
       
   132 			TIpcArgs(&aProcessName, &procId)));
       
   133 	
       
   134 	return procId();
       
   135 	}
       
   136 
       
   137 EXPORT_C TInt RMemSpySession::ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue )
       
   138 	{
       
   139 	TPckgBuf<TProcessId> arg1( aId );
       
   140 	TPckgBuf<TBool> arg2( aValue );
       
   141 	TIpcArgs args( &arg1, &arg2 );
       
   142 		
       
   143 	TInt error = SendReceive( EMemSpyClientServerOpProcessSystemPermanentOrCritical, args );
       
   144 	
       
   145 	aValue = arg2();
       
   146 	
       
   147 	return error;
       
   148 	}
       
   149 
       
   150 EXPORT_C TInt RMemSpySession::EndProcessL( TProcessId aId, TMemSpyEndType aType )
       
   151 	{
       
   152 	TPckgBuf<TProcessId> arg1( aId );
       
   153 	TPckgBuf<TMemSpyEndType> arg2( aType );
       
   154 	TIpcArgs args( &arg1, &arg2 );
       
   155 	
       
   156 	TInt error = SendReceive( EMemSpyClientServerOpEndProcess, args );
       
   157 	
       
   158 	return error;
       
   159 	}
       
   160 
       
   161 EXPORT_C TInt RMemSpySession::SwitchToProcess( TProcessId aId, TBool aBrought )
       
   162 	{
       
   163 	TPckgBuf<TProcessId> arg1( aId );
       
   164 	TPckgBuf<TBool> arg2( aBrought );
       
   165 	TIpcArgs args( &arg1, &arg2 );
       
   166 	
       
   167 	TInt error = SendReceive( EMemSpyClientServerOpSwitchToProcess, args );
       
   168 	
       
   169 	return error;	
       
   170 	}
       
   171 
       
   172 // Threads related methods
       
   173 EXPORT_C void RMemSpySession::GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType)
       
   174 	{
       
   175 	TPckgBuf<TInt> count;
       
   176 	TPckgBuf<TProcessId> pid(aProcessId);
       
   177 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreadCount, TIpcArgs(&count, &pid)));
       
   178 	
       
   179 	TInt requestedCount = count();
       
   180 	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyThreadData));
       
   181 	TPtr8 bufferPtr(buffer->Des());
       
   182 	
       
   183 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetThreads, TIpcArgs(&count, &bufferPtr, &pid)));
       
   184 	aThreads.Reset();
       
   185 	
       
   186 	TInt receivedCount = Min(count(), requestedCount);
       
   187 	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyThreadData))
       
   188 		{
       
   189 		TPckgBuf<TMemSpyThreadData> data;
       
   190 		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadData));
       
   191 		aThreads.AppendL(CMemSpyApiThread::NewLC(data()));
       
   192 		}
       
   193 	CleanupStack::Pop(aThreads.Count());
       
   194 	CleanupStack::PopAndDestroy(buffer);
       
   195 	}
       
   196 
       
   197 EXPORT_C void RMemSpySession::SetThreadPriorityL(TThreadId aId, TInt aPriority)
       
   198 	{
       
   199 	TPckgBuf<TThreadId> arg1( aId );
       
   200 	TPckgBuf<TInt> arg2( aPriority );
       
   201 	
       
   202 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpSetThreadPriority, TIpcArgs(&arg1, &arg2)));
       
   203 	}
       
   204 
       
   205 EXPORT_C TInt RMemSpySession::ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue )
       
   206 	{
       
   207 	TPckgBuf<TThreadId> arg1( aId );
       
   208 	TPckgBuf<TBool> arg2( aValue );
       
   209 	TIpcArgs args( &arg1, &arg2 );
       
   210 	
       
   211 	TInt error = SendReceive( EMemSpyClientServerOpThreadSystemPermanentOrCritical, args );
       
   212 	
       
   213 	aValue = arg2();
       
   214 	
       
   215 	return error;
       
   216 	}
       
   217 
       
   218 EXPORT_C TInt RMemSpySession::EndThreadL( TThreadId aId, TMemSpyEndType aType )
       
   219 	{
       
   220 	TPckgBuf<TThreadId> arg1( aId );
       
   221 	TPckgBuf<TMemSpyEndType> arg2( aType );
       
   222 	TIpcArgs args( &arg1, &arg2 );
       
   223 	
       
   224 	TInt error = SendReceive( EMemSpyClientServerOpEndThread, args );
       
   225 	
       
   226 	return error;
       
   227 	}
       
   228 
       
   229 EXPORT_C TInt RMemSpySession::SwitchToThread( TThreadId aId, TBool aBrought )
       
   230 	{
       
   231 	TPckgBuf<TThreadId> arg1( aId );
       
   232 	TPckgBuf<TBool> arg2( aBrought );
       
   233 	TIpcArgs args( &arg1, &arg2 );
       
   234 	
       
   235 	TInt error = SendReceive( EMemSpyClientServerOpSwitchToThread, args );
       
   236 	
       
   237 	return error;	
       
   238 	}
       
   239 
       
   240 EXPORT_C TInt RMemSpySession::GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType )
       
   241 	{
       
   242 	TPckgBuf<TInt> arg1( aIndex );
       
   243 	TPckgBuf<TThreadId> arg2( aId );
       
   244 	TPckgBuf<TMemSpyThreadInfoItemType> arg3;
       
   245 	TIpcArgs args( &arg1, &arg2, &arg3 );
       
   246 		
       
   247 	TInt error = SendReceive( EMemSpyClientServerOpGetInfoItemType, args );
       
   248 	
       
   249 	aType = arg3();
       
   250 	
       
   251 	return error;
       
   252 	}
       
   253 
       
   254 EXPORT_C void RMemSpySession::GetThreadInfoItemsL( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
       
   255 	{
       
   256 	TPckgBuf<TThreadId> id( aId );	
       
   257 	TPckgBuf<TMemSpyThreadInfoItemType> type( aType );
       
   258 	TPckgBuf<TInt> count;	
       
   259 	
       
   260 	TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItemsCount, TIpcArgs( &id, &type, &count ) );
       
   261 	TInt itemCount = count();
       
   262 	
       
   263 	if( error == KErrNone )
       
   264 		{		
       
   265 		if( itemCount == 0 )
       
   266 			{
       
   267 			aInfoItems.Reset();
       
   268 			}
       
   269 		else
       
   270 			{
       
   271 			HBufC8* buffer = HBufC8::NewLC( itemCount * sizeof(TMemSpyThreadInfoItemData) );
       
   272 			TPtr8 bufferPtr(buffer->Des());
       
   273 			
       
   274 			TPckgBuf<TInt> requestedCount( itemCount );
       
   275 			
       
   276 			TIpcArgs args( &requestedCount, &id, &type, &bufferPtr );
       
   277 			TInt error = SendReceive( EMemSpyClientServerOpGetThreadInfoItems, args ); // TODO check error
       
   278 			
       
   279 			aInfoItems.Reset();
       
   280 		
       
   281 			for(TInt i=0, offset = 0; i < itemCount; i++, offset+=sizeof(TMemSpyThreadInfoItemData))
       
   282 				{
       
   283 				TPckgBuf<TMemSpyThreadInfoItemData> data;
       
   284 				data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyThreadInfoItemData));
       
   285 				aInfoItems.AppendL(CMemSpyApiThreadInfoItem::NewLC(data()));
       
   286 				}
       
   287 			
       
   288 			CleanupStack::Pop(aInfoItems.Count());
       
   289 			CleanupStack::PopAndDestroy(buffer);
       
   290 			}
       
   291 		}
       
   292 	
       
   293 	User::LeaveIfError(error);
       
   294 	}
       
   295 
       
   296 EXPORT_C TInt RMemSpySession::GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType )
       
   297 	{
       
   298 	TRAPD(error, GetThreadInfoItemsL(aInfoItems, aId, aType));
       
   299 	return error;
       
   300 	}
       
   301 
       
   302 EXPORT_C void RMemSpySession::GetProcessIdByThreadId( TProcessId& aPID, TThreadId aTID )
       
   303 	{	
       
   304 	TPckgBuf<TProcessId> pid(aPID);
       
   305 	TPckgBuf<TThreadId> tid(aTID);
       
   306 	
       
   307 	TIpcArgs args( &pid, &tid );
       
   308 	User::LeaveIfError( SendReceive( EMemSpyClientServerOpGetProcessIdByThreadId, args ) );
       
   309 	aPID = pid();
       
   310 	}
       
   311 
       
   312 //Kernel Objects specific operations
       
   313 EXPORT_C void RMemSpySession::GetKernelObjectsL( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
       
   314 	{		
       
   315 	TPckgBuf<TInt> count;
       
   316 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectCount, TIpcArgs(&count) ));
       
   317 	
       
   318 	TInt requestedCount = count();
       
   319 	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyKernelObjectData));
       
   320 	TPtr8 bufferPtr(buffer->Des());
       
   321 		
       
   322 	TIpcArgs args( &count, &bufferPtr );
       
   323 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjects, args ));
       
   324 	
       
   325 	aKernelObjects.Reset();
       
   326 	
       
   327 	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyKernelObjectData))
       
   328 		{
       
   329 		TPckgBuf<TMemSpyKernelObjectData> data;
       
   330 		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyKernelObjectData));
       
   331 		aKernelObjects.AppendL(CMemSpyApiKernelObject::NewLC(data()));
       
   332 		}
       
   333 	
       
   334 	CleanupStack::Pop(aKernelObjects.Count());
       
   335 	CleanupStack::PopAndDestroy(buffer);
       
   336 	}
       
   337 
       
   338 EXPORT_C TInt RMemSpySession::GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects )
       
   339 	{
       
   340 	TRAPD(error, GetKernelObjectsL(aKernelObjects));
       
   341 	return error;
       
   342 	}
       
   343 
       
   344 EXPORT_C void RMemSpySession::GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
       
   345 	{
       
   346 	TPckgBuf<TInt> count;
       
   347 	TPckgBuf<TMemSpyDriverContainerType> type(aForContainer);
       
   348 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItemCount, TIpcArgs(&count, &type) ));
       
   349 
       
   350 	TInt requestedCount = count();
       
   351 	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyDriverHandleInfoGeneric));
       
   352 	TPtr8 bufferPtr(buffer->Des());
       
   353 	
       
   354 	TIpcArgs args( &count, &type, &bufferPtr );
       
   355 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItems, args ));
       
   356 	
       
   357 	aKernelObjectItems.Reset();
       
   358 	
       
   359 	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyDriverHandleInfoGeneric))
       
   360 		{
       
   361 		TPckgBuf<TMemSpyDriverHandleInfoGeneric> data;
       
   362 		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyDriverHandleInfoGeneric));
       
   363 		aKernelObjectItems.AppendL( CMemSpyApiKernelObjectItem::NewLC( data() ) );
       
   364 		}
       
   365 	CleanupStack::Pop(aKernelObjectItems.Count());
       
   366 	CleanupStack::PopAndDestroy(buffer);
       
   367 	}
       
   368 
       
   369 EXPORT_C TInt RMemSpySession::GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer )
       
   370 	{
       
   371 	TRAPD(error, GetKernelObjectItemsL(aKernelObjectItems, aForContainer));
       
   372 	return error;
       
   373 	}
       
   374 
       
   375 EXPORT_C void RMemSpySession::GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles)
       
   376 	{
       
   377 	TPckgBuf<TInt> count;
       
   378 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, TIpcArgs(&count) ));
       
   379 	
       
   380 	TInt requestedCount = count();
       
   381 	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyMemoryTrackingCycleData));
       
   382 	TPtr8 bufferPtr(buffer->Des());
       
   383 		
       
   384 	TIpcArgs args( &count, &bufferPtr );
       
   385 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycles, args ));
       
   386 	
       
   387 	aCycles.Reset();
       
   388 	
       
   389 	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyMemoryTrackingCycleData))
       
   390 		{
       
   391 		TPckgBuf<TMemSpyMemoryTrackingCycleData> data;
       
   392 		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyMemoryTrackingCycleData));
       
   393 		aCycles.AppendL(CMemSpyApiMemoryTrackingCycle::NewLC(data()));
       
   394 		}
       
   395 	
       
   396 	CleanupStack::Pop(aCycles.Count());
       
   397 	CleanupStack::PopAndDestroy(buffer);
       
   398 	}
       
   399 
       
   400 EXPORT_C void RMemSpySession::OutputAllContainerContents()
       
   401 	{
       
   402 	SendReceive( EMemSpyClientServerOpOutputAllContainerContents );
       
   403 	}
       
   404 
       
   405 
       
   406 //Heap specific operations
       
   407 
       
   408 EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeapL()
       
   409 	{
       
   410 	CMemSpyApiHeap* aHeap;
       
   411 	
       
   412 	HBufC8* buffer = HBufC8::NewLC( sizeof(TMemSpyHeapData) );
       
   413 	TPtr8 bufferPtr(buffer->Des());
       
   414 	TIpcArgs args( &bufferPtr );
       
   415 	
       
   416 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetHeap, args ));
       
   417 	
       
   418 	TPckgBuf<TMemSpyHeapData> data;
       
   419 	data.Copy(bufferPtr.Ptr(), sizeof(TMemSpyHeapData));		
       
   420 	aHeap = CMemSpyApiHeap::NewL( data() );
       
   421 	
       
   422 	CleanupStack::PopAndDestroy(buffer);
       
   423 		
       
   424 	return aHeap;
       
   425 	}
       
   426 
       
   427 EXPORT_C CMemSpyApiHeap* RMemSpySession::GetHeap()
       
   428 	{
       
   429 	CMemSpyApiHeap *result = NULL;
       
   430 	TRAPD(error, result = GetHeapL());
       
   431 	return error == KErrNone ? result : NULL;
       
   432 	}
       
   433 
       
   434 
       
   435 
       
   436 EXPORT_C void RMemSpySession::GetEComCategoriesL(RArray<CMemSpyApiEComCategory*> &aCategories)
       
   437     {
       
   438     TPckgBuf<TInt> count;
       
   439     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComCategoryCount, TIpcArgs(&count)));
       
   440     
       
   441     TInt requestedCount = count();
       
   442     HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComCategoryData));
       
   443     TPtr8 bufferPtr(buffer->Des());
       
   444     
       
   445     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComCategories, TIpcArgs(&count, &bufferPtr)));
       
   446     aCategories.Reset();
       
   447     
       
   448     TInt receivedCount = Min(count(), requestedCount);
       
   449     for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEComCategoryData))
       
   450         {
       
   451         TPckgBuf<TMemSpyEComCategoryData> data;
       
   452         data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComCategoryData));
       
   453         aCategories.AppendL(CMemSpyApiEComCategory::NewLC(data()));
       
   454         }
       
   455     CleanupStack::Pop(aCategories.Count());
       
   456     CleanupStack::PopAndDestroy(buffer);
       
   457     }
       
   458     
       
   459 EXPORT_C void RMemSpySession::GetEComInterfacesL(TUid aCategory, RArray<CMemSpyApiEComInterface*> &aInterfaces)
       
   460     {
       
   461     TPckgBuf<TInt> count;
       
   462     TPckgBuf<TUid> category(aCategory);
       
   463     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComInterfaceCount, TIpcArgs(&count, &category)));
       
   464     
       
   465     TInt requestedCount = count();
       
   466     HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComInterfaceData));
       
   467     TPtr8 bufferPtr(buffer->Des());
       
   468     
       
   469     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComInterfaces, TIpcArgs(&count, &category, &bufferPtr)));
       
   470     aInterfaces.Reset();
       
   471     
       
   472     TInt receivedCount = Min(count(), requestedCount);
       
   473     for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEComInterfaceData))
       
   474         {
       
   475         TPckgBuf<TMemSpyEComInterfaceData> data;
       
   476         data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComInterfaceData));
       
   477         aInterfaces.AppendL(CMemSpyApiEComInterface::NewLC(data()));
       
   478         }
       
   479     CleanupStack::Pop(aInterfaces.Count());
       
   480     CleanupStack::PopAndDestroy(buffer);
       
   481     }
       
   482 
       
   483 EXPORT_C void RMemSpySession::GetEComImplementationsL(TUid aInterface, RArray<CMemSpyApiEComImplementation*> &aImplementations)
       
   484     {
       
   485     TPckgBuf<TInt> count;
       
   486     TPckgBuf<TUid> interface(aInterface);
       
   487     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementationCount, TIpcArgs(&count, &interface)));
       
   488     
       
   489     TInt requestedCount = count();
       
   490     HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEComImplementationData));
       
   491     TPtr8 bufferPtr(buffer->Des());
       
   492     
       
   493     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetEComImplementations, TIpcArgs(&count, &interface, &bufferPtr)));
       
   494     aImplementations.Reset();
       
   495     
       
   496     TInt receivedCount = Min(count(), requestedCount);
       
   497     for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEComImplementationData))
       
   498         {
       
   499         TPckgBuf<TMemSpyEComImplementationData> data;
       
   500         data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEComImplementationData));
       
   501         aImplementations.AppendL(CMemSpyApiEComImplementation::NewLC(data()));
       
   502         }
       
   503     CleanupStack::Pop(aImplementations.Count());
       
   504     CleanupStack::PopAndDestroy(buffer);
       
   505     }
       
   506 
       
   507 EXPORT_C void RMemSpySession::DumpKernelHeap()
       
   508 	{
       
   509 	SendReceive( EMemSpyClientServerOpDumpKernelHeap );
       
   510 	}
       
   511 
       
   512 EXPORT_C void RMemSpySession::OutputKernelHeapDataL()
       
   513 	{		
       
   514 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
       
   515 			TIpcArgs(KMemSpyClientServerThreadIdKernel)));
       
   516 	
       
   517 	}
       
   518 
       
   519 EXPORT_C void RMemSpySession::OutputKernelHeapData(TRequestStatus& aStatus)
       
   520 	{
       
   521 	SendReceive(EMemSpyClientServerOpHeapData,
       
   522 		TIpcArgs(KMemSpyClientServerThreadIdKernel),
       
   523 		aStatus);
       
   524 	}
       
   525 
       
   526 EXPORT_C void RMemSpySession::OutputThreadHeapDataL( TThreadId aThreadId)
       
   527 	{			
       
   528 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadId,
       
   529 			TIpcArgs(aThreadId)));
       
   530 	}
       
   531 
       
   532 EXPORT_C void RMemSpySession::OutputThreadHeapDataL(const TDesC& aThreadName)
       
   533 	{	
       
   534 	const TIpcArgs args( &aThreadName );
       
   535 	        
       
   536 	User::LeaveIfError( SendReceive( EMemSpyClientServerOpHeapData | KMemSpyOpFlagsIncludesThreadName, args ));	
       
   537 	}
       
   538 
       
   539 EXPORT_C void RMemSpySession::OutputThreadCellListL(TThreadId aThreadId)
       
   540 	{	
       
   541 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsIncludesThreadId,
       
   542 			TIpcArgs(aThreadId)));
       
   543 	}
       
   544 
       
   545 EXPORT_C void RMemSpySession::OutputHeapInfoUserL(TThreadId aThreadId)
       
   546 	{
       
   547 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsIncludesThreadId,
       
   548 			TIpcArgs(aThreadId)));
       
   549 	}
       
   550 
       
   551 EXPORT_C void RMemSpySession::SwitchOutputSinkL( TMemSpySinkType aType )
       
   552 	{
       
   553 	TInt op;
       
   554 	if( aType == ESinkTypeFile )
       
   555 		op = EMemSpyClientServerOpSwitchOutputSinkFile;
       
   556 	else
       
   557 		op = EMemSpyClientServerOpSwitchOutputSinkTrace;
       
   558 			
       
   559 	User::LeaveIfError(SendReceive( op ));
       
   560 	}
       
   561 
       
   562 EXPORT_C void RMemSpySession::SwitchOutputToTraceL()
       
   563 	{
       
   564 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkTrace));
       
   565 	}
       
   566     
       
   567 EXPORT_C void RMemSpySession::SwitchOutputToFileL(const TDesC& aRootFolder)
       
   568 	{
       
   569 	TIpcArgs args;
       
   570 	if (aRootFolder.Length())
       
   571 		{
       
   572 		args.Set(0, &aRootFolder);
       
   573 		}
       
   574 	
       
   575 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSwitchOutputSinkFile, args));
       
   576 	}
       
   577 
       
   578 EXPORT_C void RMemSpySession::OutputStackInfoL(TThreadId aThreadId)
       
   579 	{
       
   580 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsIncludesThreadId,
       
   581 			TIpcArgs(aThreadId)));
       
   582 	}
       
   583 
       
   584 EXPORT_C void RMemSpySession::OutputStackDataL(TThreadId aThreadId, TMemSpyDriverDomainType aType )
       
   585 	{
       
   586 	TInt op;
       
   587 	if( aType == EMemSpyDriverDomainUser )
       
   588 		op = EMemSpyClientServerOpStackDataUser;
       
   589 	else
       
   590 		op = EMemSpyClientServerOpStackDataKernel;
       
   591 	
       
   592 	User::LeaveIfError(SendReceive( op | KMemSpyOpFlagsIncludesThreadId,
       
   593 			TIpcArgs(aThreadId, aType)));
       
   594 		
       
   595 	}
       
   596 
       
   597 EXPORT_C void RMemSpySession::OutputThreadInfoHandlesL(TThreadId aThreadId)
       
   598 	{
       
   599 	TPckgBuf<TThreadId> id(aThreadId);
       
   600 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputInfoHandles, TIpcArgs( &id )));	
       
   601 	}
       
   602 
       
   603 EXPORT_C void RMemSpySession::OutputAOListL(TThreadId aId, TMemSpyThreadInfoItemType aType)
       
   604 	{
       
   605 	TPckgBuf<TThreadId> id(aId);
       
   606 	TPckgBuf<TMemSpyThreadInfoItemType> type(aType);
       
   607 	
       
   608 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpOutputAOList, TIpcArgs( &id, &type )));
       
   609 	}
       
   610 
       
   611 EXPORT_C void RMemSpySession::OutputKernelObjectsL()
       
   612 	{
       
   613 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpEnumerateKernelContainerAll));
       
   614 	}
       
   615 
       
   616 EXPORT_C void RMemSpySession::OutputCompactStackInfoL()
       
   617 	{
       
   618 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpStackInfoCompact)); 
       
   619 	}
       
   620 
       
   621 EXPORT_C void RMemSpySession::OutputCompactHeapInfoL()
       
   622 	{
       
   623 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpHeapInfoCompact)); 
       
   624 	}
       
   625 // Asynchronous operations
       
   626 EXPORT_C void RMemSpySession::OutputPhoneInfo(TRequestStatus& aStatus)
       
   627 	{	
       
   628 	SendReceive(EMemSpyClientServerOpSummaryInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   629 	}
       
   630 
       
   631 EXPORT_C void RMemSpySession::OutputDetailedPhoneInfo(TRequestStatus& aStatus)
       
   632 	{	
       
   633 	SendReceive(EMemSpyClientServerOpSummaryInfoDetailed | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   634 	}
       
   635 
       
   636 EXPORT_C void RMemSpySession::OutputHeapInfo(TRequestStatus& aStatus)
       
   637 	{	
       
   638 	SendReceive(EMemSpyClientServerOpHeapInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   639 	}
       
   640 
       
   641 EXPORT_C void RMemSpySession::OutputCompactHeapInfo(TRequestStatus& aStatus)
       
   642 	{	
       
   643 	SendReceive(EMemSpyClientServerOpHeapInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   644 	}
       
   645 
       
   646 EXPORT_C void RMemSpySession::OutputHeapCellListing(TRequestStatus& aStatus)
       
   647 	{	
       
   648 	SendReceive(EMemSpyClientServerOpHeapCellListing | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   649 	}
       
   650 
       
   651 EXPORT_C void RMemSpySession::OutputHeapData(TRequestStatus& aStatus)
       
   652 	{	
       
   653 	SendReceive(EMemSpyClientServerOpHeapData | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   654 	}
       
   655 
       
   656 // synchronous version of the operation - for CLI
       
   657 EXPORT_C void RMemSpySession::OutputHeapData()
       
   658 	{
       
   659 	SendReceive(EMemSpyClientServerOpHeapData);
       
   660 	}
       
   661 
       
   662 EXPORT_C void RMemSpySession::OutputStackInfo(TRequestStatus& aStatus)
       
   663 	{	
       
   664 	SendReceive(EMemSpyClientServerOpStackInfo | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   665 	}
       
   666 
       
   667 EXPORT_C void RMemSpySession::OutputCompactStackInfo(TRequestStatus& aStatus)
       
   668 	{	
       
   669 	SendReceive(EMemSpyClientServerOpStackInfoCompact | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   670 	}
       
   671 
       
   672 EXPORT_C void RMemSpySession::OutputUserStackData(TRequestStatus& aStatus)
       
   673 	{	
       
   674 	SendReceive(EMemSpyClientServerOpStackDataUser | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   675 	}
       
   676 
       
   677 EXPORT_C void RMemSpySession::OutputKernelStackData(TRequestStatus& aStatus)
       
   678 	{	
       
   679 	SendReceive(EMemSpyClientServerOpStackDataKernel | KMemSpyOpFlagsAsyncOperation, TIpcArgs(), aStatus);
       
   680 	}
       
   681 
       
   682 // Synchronous operations
       
   683 EXPORT_C void RMemSpySession::OutputPhoneInfo()
       
   684 	{	
       
   685 	SendReceive( EMemSpyClientServerOpSummaryInfo , TIpcArgs() );
       
   686 	}
       
   687 
       
   688 EXPORT_C TInt RMemSpySession::GetSwmtCyclesCount()
       
   689 	{
       
   690 	TPckgBuf<TInt> count;
       
   691 	TIpcArgs args( &count );
       
   692 		
       
   693 	User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, args ));
       
   694 	
       
   695 	return count();
       
   696 	}
       
   697 
       
   698 EXPORT_C void RMemSpySession::SetSwmtAutoStartProcessList( CArrayFixFlat<TUid>* aList )
       
   699 	{
       
   700 	TInt count = aList->Count();
       
   701 	TIpcArgs args( &aList, &count );
       
   702 	
       
   703 	SendReceive( EMemSpyClientServerOpSetSwmtAutoStartProcessList, args );
       
   704 	}
       
   705 
       
   706 EXPORT_C void RMemSpySession::SwmtResetTracking()
       
   707 	{
       
   708 	SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingReset );
       
   709 	}
       
   710 
       
   711 EXPORT_C void RMemSpySession::GetOutputSink( TMemSpySinkType& aType )
       
   712 	{
       
   713 	TPckgBuf<TMemSpySinkType> type( aType );
       
   714 	TIpcArgs args( &type );
       
   715 	
       
   716 	SendReceive( EMemSpyClientServerOpGetOutputSink, args );
       
   717 	
       
   718 	aType = type();
       
   719 	}
       
   720 
       
   721 EXPORT_C void RMemSpySession::NotifyDeviceWideOperationProgress(TMemSpyDeviceWideOperationProgress &aProgress, TRequestStatus &aStatus)
       
   722 	{
       
   723 	SendReceive(EMemSpyClientServerOpNotifyDeviceWideOperationProgress | KMemSpyOpFlagsAsyncOperation,
       
   724 			TIpcArgs(&aProgress.iProgress, &aProgress.iDescription), 
       
   725 			aStatus);
       
   726 	}
       
   727 
       
   728 EXPORT_C void RMemSpySession::CancelDeviceWideOperationL()
       
   729 	{
       
   730 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpCancelDeviceWideOperation));
       
   731 	}
       
   732 
       
   733 // SWMT operations
       
   734 EXPORT_C void RMemSpySession::SetSwmtCategoriesL(TInt aCategories)
       
   735 	{
       
   736 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesSet,
       
   737 			TIpcArgs(aCategories)));
       
   738 	}
       
   739 
       
   740 EXPORT_C void RMemSpySession::SetSwmtHeapDumpsEnabledL(TBool aEnabled)
       
   741 	{
       
   742 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpSet,
       
   743 			TIpcArgs(aEnabled)));
       
   744 	}
       
   745 
       
   746 EXPORT_C void RMemSpySession::SetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode)
       
   747 	{
       
   748 	TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mode( aMode );
       
   749 	TIpcArgs args(&mode);
       
   750 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingModeSet, args));
       
   751 	}
       
   752 
       
   753 EXPORT_C TBool RMemSpySession::IsSwmtRunningL()
       
   754 	{
       
   755 	TPckgBuf<TBool> ret;
       
   756 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpIsSwmtRunning, TIpcArgs(&ret)));
       
   757 	
       
   758 	return ret();
       
   759 	}
       
   760 
       
   761 EXPORT_C void RMemSpySession::StartSwmtTimerL(TInt aPeriod)
       
   762 	{
       
   763 	SetSwmtTimerIntervalL(aPeriod);
       
   764 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
       
   765 	}
       
   766 
       
   767 EXPORT_C void RMemSpySession::StartSwmtTimerL()
       
   768 	{
       
   769 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStart));
       
   770 	}
       
   771 
       
   772 EXPORT_C void RMemSpySession::SetSwmtTimerIntervalL(TInt aPeriod)
       
   773 	{
       
   774 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodSet,
       
   775 			TIpcArgs(aPeriod)));
       
   776 	}
       
   777 
       
   778 EXPORT_C void RMemSpySession::StopSwmtTimerL()
       
   779 	{
       
   780 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop));
       
   781 	}
       
   782 
       
   783 
       
   784 EXPORT_C void RMemSpySession::ForceSwmtUpdateL()
       
   785 	{
       
   786 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate));
       
   787 	}
       
   788 
       
   789 EXPORT_C void RMemSpySession::ForceSwmtUpdate(TRequestStatus& aStatus)
       
   790 	{
       
   791 	SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingForceUpdate, 
       
   792 			TIpcArgs(),
       
   793 			aStatus);
       
   794 	}
       
   795 
       
   796 EXPORT_C void RMemSpySession::SetSwmtFilter( const TDesC& aFilter )
       
   797 	{	
       
   798 	TIpcArgs args( &aFilter );
       
   799 	User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterSet, args ) );
       
   800 	}
       
   801 
       
   802 EXPORT_C void RMemSpySession::GetSwmtFilter( TName& aFilter )
       
   803 	{
       
   804     TPckgBuf<TName> name;
       
   805     TIpcArgs args( &name );
       
   806 		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingThreadNameFilterGet, args ) );
       
   807 	aFilter = name();
       
   808 	}
       
   809         
       
   810 EXPORT_C void RMemSpySession::GetSwmtCategoriesL(TInt& aCategories)
       
   811 	{
       
   812 	TPckgBuf<TInt> cat;	
       
   813 	TIpcArgs args( &cat );
       
   814 		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingCategoriesGet, args ) );
       
   815 	aCategories = cat();
       
   816 	}
       
   817 
       
   818 EXPORT_C void RMemSpySession::GetSwmtHeapDumpsEnabledL(TBool& aEnabled)
       
   819 	{
       
   820 	TPckgBuf<TBool> enabled;
       
   821 	TIpcArgs args( &enabled );
       
   822 		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingHeapDumpGet, args ) );
       
   823 		
       
   824 	aEnabled = enabled();
       
   825 	}
       
   826         
       
   827 EXPORT_C void RMemSpySession::GetSwmtMode(TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode& aMode)
       
   828 	{
       
   829 	TPckgBuf<TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode> mode;
       
   830 	TIpcArgs args( &mode );
       
   831 		User::LeaveIfError( SendReceive( EMemSpyClientServerOpSystemWideMemoryTrackingModeGet, args ) );
       
   832 	aMode = mode();
       
   833 	}
       
   834     
       
   835 EXPORT_C void RMemSpySession::GetSwmtTimerIntervalL(TInt& aPeriod)
       
   836 	{
       
   837 	TPckgBuf<TInt> time;
       
   838 	TIpcArgs args( &time );
       
   839 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpSystemWideMemoryTrackingTimerPeriodGet,
       
   840 			args));
       
   841 	aPeriod = time();
       
   842 	}
       
   843 
       
   844 EXPORT_C TInt TMemSpyDeviceWideOperationProgress::Progress() const 
       
   845 	{
       
   846 	return iProgress();
       
   847 	}
       
   848 
       
   849 EXPORT_C const TDesC& TMemSpyDeviceWideOperationProgress::Description() const
       
   850 	{
       
   851 	return iDescription;
       
   852 	}
       
   853 
       
   854 // Servers
       
   855 EXPORT_C void RMemSpySession::GetServersL(RArray<CMemSpyApiServer*> &aServers)
       
   856     {
       
   857     TPckgBuf<TInt> count;
       
   858     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServerCount, TIpcArgs(&count)));
       
   859     
       
   860     TInt requestedCount = count();
       
   861     HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyServerData));
       
   862     TPtr8 bufferPtr(buffer->Des());
       
   863     
       
   864     User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServers, TIpcArgs(&count, &bufferPtr)));
       
   865     aServers.Reset();
       
   866     
       
   867     TInt receivedCount = Min(count(), requestedCount);
       
   868     for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyServerData))
       
   869         {
       
   870         TPckgBuf<TMemSpyServerData> data;
       
   871         data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyServerData));
       
   872         aServers.AppendL(CMemSpyApiServer::NewLC(data()));
       
   873         }
       
   874     CleanupStack::Pop(aServers.Count());
       
   875     CleanupStack::PopAndDestroy(buffer);
       
   876     }
       
   877 
       
   878 EXPORT_C void RMemSpySession::GetServersL(RArray<CMemSpyApiServer*> &aServers, TSortType aSortType)
       
   879 	{
       
   880 	TPckgBuf<TInt> count;
       
   881 	TPckgBuf<TSortType> sort( aSortType );
       
   882 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetServerCount, TIpcArgs(&count)));
       
   883 	    	
       
   884 	TInt requestedCount = count();
       
   885 	HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyServerData));
       
   886 	TPtr8 bufferPtr(buffer->Des());
       
   887 	    
       
   888 	User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetSortedServers, TIpcArgs(&count, &bufferPtr, &sort)));
       
   889 	aServers.Reset();
       
   890 	    
       
   891 	TInt receivedCount = Min(count(), requestedCount);
       
   892 	for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyServerData))
       
   893 		{
       
   894 		TPckgBuf<TMemSpyServerData> data;
       
   895 		data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyServerData));
       
   896 		aServers.AppendL(CMemSpyApiServer::NewLC(data()));
       
   897 		}
       
   898 	CleanupStack::Pop(aServers.Count());
       
   899 	CleanupStack::PopAndDestroy(buffer);
       
   900 	}
       
   901 
       
   902 EXPORT_C void RMemSpySession::ServerListOutputGenericL( TBool aDetailed )
       
   903 	{
       
   904 	TPckgBuf<TBool> detailed( aDetailed );
       
   905 	TIpcArgs args( &detailed );
       
   906 	User::LeaveIfError( SendReceive( EMemSpyClientServerOpServerListOutputGeneric, args ) );
       
   907 	}
       
   908