Revision: 201039
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 02:45:59 +0300
changeset 55 f2950aff7424
parent 48 516af714ebb4
Revision: 201039 Kit: 201039
package_definition.xml
perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h
perfsrv/analyzetool/commandlineengine/inc/ATCommonDefines.h
perfsrv/analyzetool/commandlineengine/install/atool.exe
perfsrv/analyzetool/commandlineengine/src/CATBase.cpp
perfsrv/analyzetool/commandlineengine/src/CATParseTraceFile.cpp
perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfilelog.cpp
perfsrv/analyzetool/group/ReleaseNotes_AnalyzeTool.txt
perfsrv/analyzetool/kerneleventhandler/src/analyzetooleventhandler.cpp
perfsrv/analyzetool/sis/AnalyzeTool.pkg
perfsrv/analyzetool/sis/AnalyzeTool_udeb.pkg
perfsrv/analyzetool/sis/analyzeTool_stub.pkg
perfsrv/memspy/CommandLine/Source/MemSpyCommandLine.cpp
perfsrv/memspy/CommandLine/group/MemSpyCommandLine.mmp
perfsrv/memspy/Driver/BWINS/memspydriverclientu.def
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h
perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverOSAdaption.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapBase.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapData.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapDataBase.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapDataKernel.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapDataUser.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapInfo.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalk.h
perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalkUser.h
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverHeap.cpp
perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverLogicalChannel.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapBase.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapData.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapDataBase.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapDataKernel.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapDataUser.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapInfo.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalk.cpp
perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalkUser.cpp
perfsrv/memspy/Driver/Shared/MemSpyDriverObjectsInternal.h
perfsrv/memspy/Driver/Shared/MemSpyDriverOpCodes.h
perfsrv/memspy/Driver/Shared/heaputils.cpp
perfsrv/memspy/Driver/Shared/heaputils.h
perfsrv/memspy/Driver/User/Source/MemSpyDriverClient.cpp
perfsrv/memspy/Driver/eabi/memspydriverclientu.def
perfsrv/memspy/Driver/eabi/memspydriveru.def
perfsrv/memspy/Driver/group/MemSpyDriver.mmp
perfsrv/memspy/Engine/BWINS/MemSpyEngineu.def
perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp
perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperHeap.cpp
perfsrv/memspy/Engine/eabi/MemSpyEngineu.def
perfsrv/memspy/Engine/group/MemSpyEngine.mmp
perfsrv/memspy/MemSpyClient/bwins/MemSpyClientu.def
perfsrv/memspy/MemSpyClient/eabi/MemSpyClientu.def
perfsrv/memspy/MemSpyClient/group/MemSpyClient.mmp
perfsrv/memspy/MemSpyClient/group/bld.inf
perfsrv/memspy/MemSpyClient/inc/memspyapimemorytrackingcycle.h
perfsrv/memspy/MemSpyClient/inc/memspyapiserver.h
perfsrv/memspy/MemSpyClient/inc/memspyapiwindowgroup.h
perfsrv/memspy/MemSpyClient/inc/memspyserverdata.h
perfsrv/memspy/MemSpyClient/inc/memspysession.h
perfsrv/memspy/MemSpyClient/src/memspyapiserver.cpp
perfsrv/memspy/MemSpyClient/src/memspyapiwindowgroup.cpp
perfsrv/memspy/MemSpyClient/src/memspysession.cpp
perfsrv/memspy/MemSpyServer/group/MemSpyServer.mmp
perfsrv/memspy/group/ReleaseNotes_MemSpy.txt
perfsrv/memspy/memspy_plat/memspy_api/include/MemSpyEngineClientInterface.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/kernel/MemSpyDriverPanics.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverClient.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h
perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h
--- a/package_definition.xml	Fri Sep 17 08:38:31 2010 +0300
+++ b/package_definition.xml	Mon Oct 04 02:45:59 2010 +0300
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <SystemDefinition schema="3.0.0">
-  <package id="osrndtools" name="OS R&amp;D Tools">
+  <package id="osrndtools" name="OS R&amp;D Tools" levels="trace analysis">
     <collection id="debugsrv" name="Debug Services" level="trace">
       <component id="runmodedebug" filter="s60" name="Run Mode Debug" purpose="development">
         <unit bldFile="debugsrv/runmodedebug/group"/>
@@ -17,7 +17,7 @@
         <unit bldFile="perfsrv/piprofiler/group"/>
       </component>
     </collection>
-    <collection id="tracefw" name="Trace Services" level="trace">
+    <collection id="tracefw" name="Trace Framework" level="trace">
       <component id="tracecompiler" filter="s60" name="TraceCompiler" purpose="development">
         <unit bldFile="tracefw/tracecompiler/group"/>
       </component>
--- a/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h	Mon Oct 04 02:45:59 2010 +0300
@@ -24,7 +24,7 @@
 
 //Version information for command line engine.
 //Tells the version of AT core componenets.
-//ANALYZETOOL_CORE_VERSION_FOR_CLE 1.10.0
+//ANALYZETOOL_CORE_VERSION_FOR_CLE 1.10.1
 
 // CONSTANTS
 inline TVersion KAnalyzeToolLddVersion() { return TVersion(1, 0, 1); }
--- a/perfsrv/analyzetool/commandlineengine/inc/ATCommonDefines.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/commandlineengine/inc/ATCommonDefines.h	Mon Oct 04 02:45:59 2010 +0300
@@ -130,8 +130,8 @@
 const string AT_PROCESSNAME_TAG = "%processname%";
 
 // Atool version number and date
-#define ATOOL_VERSION "1.10.0" // NOTE! This version number is written also to temporary cpp file.
-#define ATOOL_DATE "2nd July 2010"
+#define ATOOL_VERSION "1.10.1" // NOTE! This version number is written also to temporary cpp file.
+#define ATOOL_DATE "7th September 2010"
 
 // Default/min/max call stack sizes
 const int AT_ALLOC_CALL_STACK_SIZE_DEFAULT = 40;
@@ -144,7 +144,7 @@
 
 // Constant compatibility string in temporary cpp.
 // Api version ; current version.
-#define ATOOL_COMPATIBILITY_STRING "1.7.6;1.10.0"
+#define ATOOL_COMPATIBILITY_STRING "1.7.6;1.10.1"
 
 // Datafile version
 #define AT_DATA_FILE_VERSION "DATA_FILE_VERSION 12"
Binary file perfsrv/analyzetool/commandlineengine/install/atool.exe has changed
--- a/perfsrv/analyzetool/commandlineengine/src/CATBase.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/commandlineengine/src/CATBase.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -144,12 +144,12 @@
 {
 	LOG_LOW_FUNC_ENTRY("CATBase::GetPathOrFileName");
 	string sRet;
-	size_t iPos = sInput.size()-1;
+	size_t iPos = sInput.size();
 
 	sInput = ChangeSlashToBackSlash( sInput );
 
 	//Find character '\' starting from end of string
-	while( iPos > 0 && sInput[iPos] != '\\' )
+	while( iPos > 0 && sInput[iPos-1] != '\\' )
 	{
 		iPos--;
 	}
@@ -158,12 +158,12 @@
 		//Return file name
 		if( bFileName )
 		{
-			sInput.erase( 0, iPos+1 );
+			sInput.erase( 0, iPos );
 			sRet = sInput;
 		}
 		else //Return file path
 		{
-			sInput.erase( iPos+1, string::npos );
+			sInput.erase( iPos, string::npos );
 			sRet = sInput;
 		}
 	}
@@ -1057,7 +1057,7 @@
 
 	// Hardcoded version number for support.
 	out << "\n/* The AnalyzeTool version number used. */";
-	out << "\n_LIT( KAtoolVersion, \"1.7.6;1.10.0\" );\n";
+	out << "\n_LIT( KAtoolVersion, \"1.7.6;1.10.1\" );\n";
 
 	out << "\nconst TFileName LogFileName()";
 	out << "\n    {";
--- a/perfsrv/analyzetool/commandlineengine/src/CATParseTraceFile.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/commandlineengine/src/CATParseTraceFile.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -82,7 +82,7 @@
 	}
 
 	// Open data file
-	ifstream in( pFileName );
+	ifstream in( pFileName, ios::binary );
 
 	// Check file opened ok
 	if ( !in.good() )
@@ -284,39 +284,15 @@
 			// get time string from timestamp
 			sTime = GetTimeFromTimeStamp( iTimeStamp, vProcessList[iProcessIDinList].iTimeSpan );
 
-			// TODO version with reallocation
-			//cleanedTraces << sTime << " "; //add time
-			//cleanedTraces << sLineToCleanedFile << "\n"; //add the rest of the line
-
-			// "Old style" allocation (< v.1.6)
-			if( ! _stricmp( pCommand, ALLOC_ID ) )
+			if( bCreateCleanedTraces )
 			{
-				// Add alloc
-				vProcessList[iProcessIDinList].Alloc( sRestOfLine );
+					cleanedTraces << sTime << " "; //add time
+					cleanedTraces << sLineToCleanedFile << "\n"; //add the rest of the line
+			}
 
-				// Subtests running?
-				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
-				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
-				{
-					if( viSubTestIter->bRunning )
-					{
-						// Save alloc also to sub test
-						viSubTestIter->Alloc( sRestOfLine );
-					}
-					viSubTestIter++;
-				}
-			}
-			else if ( ! _stricmp( pCommand, ALLOCH_ID ) )
+			// Allocation header
+			if ( ! _stricmp( pCommand, ALLOCH_ID ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				// Add alloc
 				vProcessList[iProcessIDinList].AllocH( sRestOfLine, sTime );
 
@@ -335,15 +311,6 @@
 			// Allocation fragment (call stack).
 			else if ( ! _stricmp( pCommand, ALLOCF_ID ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				// Add alloc fragment
 				vProcessList[iProcessIDinList].AllocF( sRestOfLine, sTime );
 				
@@ -359,13 +326,19 @@
 					viSubTestIter++;
 				}
 			}
+			//Reallocation header
 			else if ( ! _stricmp( pCommand, REALLOCH_ID ) )
 			{
+				// todo add reallocation flag?
+
+				string sFreeLine = "";
+				string sAllocLine = "";
+
 				// Add free
 
 				// get 'free' line from realloc line
 				string sFreeRestOfLine = sRestOfLine;
-				string sFreeLine = "";
+
 				sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
 				sFreeLine.append( " " );
 				// next two strings are for 'alloc' (address and size) - lets remove them
@@ -376,35 +349,14 @@
 				//add 'free' line
 				vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
 
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				// construct 'free' header trace
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << FREEH_ID << " "; //add FRH
-				cleanedTraces << sFreeLine << "\n"; //add the rest of the line
-				}
-
 				// Add alloc
 
 				//get 'alloc' line from realloc line
-				// only first string is unnecessary, lets remove it
+				// first string is for 'free' (address), lets remove it first
 				GetStringUntilNextSpace( sRestOfLine );
+				sAllocLine = sRestOfLine;
      			// add 'alloc' line
-				vProcessList[iProcessIDinList].AllocH( sRestOfLine, sTime );
-
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				// construct 'alloc' header trace
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << ALLOCH_ID << " "; //add FRH
-				cleanedTraces << sRestOfLine << "\n"; //add the rest of the line
-				}
+				vProcessList[iProcessIDinList].AllocH( sAllocLine, sTime );
 
 				// Subtests running?
 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
@@ -413,77 +365,46 @@
 					if( viSubTestIter->bRunning )
 					{
 						// Save realloc also to sub test
-						// Add free
 
-						// get 'free' line from realloc line
-						string sFreeRestOfLine = sRestOfLine;
-						string sFreeLine = "";
-						sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
-						sFreeLine.append( " " );
-						// next two strings are for 'alloc' (address and size) - lets remove them
-						GetStringUntilNextSpace( sFreeRestOfLine, true );
-						GetStringUntilNextSpace( sFreeRestOfLine, true );
-						// add rest of line to 'free' line
-						sFreeLine.append( sFreeRestOfLine );
 						//add 'free' line
 						vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
 
-						// Add alloc
-
-						//get 'alloc' line from realloc line
-						// only first string is unnecessary, lets remove it
-						GetStringUntilNextSpace( sRestOfLine );
      					// add 'alloc' line
-						vProcessList[iProcessIDinList].AllocH( sRestOfLine, sTime );
+						vProcessList[iProcessIDinList].AllocH( sAllocLine, sTime );
 					}
 					viSubTestIter++;
 				}
 			}
-			// rellocation fragment (call stack).
+			// rellocation fragment (call stack)
 			else if ( ! _stricmp( pCommand, REALLOCF_ID ) )
 			{
+				string sFreeLine = "";
+				string sAllocLine = "";
+
+				// Not used currently.
+				/*
 				// Add free fragment 
 
 				// get 'free' line from realloc line
 				string sFreeRestOfLine = sRestOfLine;
-				string sFreeLine = "";
 				sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
 				sFreeLine.append( " " );
 				// next string is for 'alloc' (address) - lets remove it
 				GetStringUntilNextSpace( sFreeRestOfLine, true );
 				// add rest of line to 'free' line
 				sFreeLine.append( sFreeRestOfLine );
+
 				//add 'free' line
-				vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
-
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				// construct 'free' fragment trace
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << FREEF_ID << " "; //add FRF
-				cleanedTraces << sFreeLine << "\n"; //add the rest of the line
-				}
+				vProcessList[iProcessIDinList].FreeF( sFreeLine, sTime );
+				*/
 
 				// Add alloc fragment
 
 				// first string is for 'free' (address), lets remove it first
 				GetStringUntilNextSpace( sRestOfLine, true );
+				sAllocLine = sRestOfLine;
 				//add 'alloc' line
-				vProcessList[iProcessIDinList].AllocF( sRestOfLine, sTime );
-
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				// construct 'alloc' fragment trace
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << ALLOCF_ID << " "; //add FRF
-				cleanedTraces << sRestOfLine << "\n"; //add the rest of the line
-				}
+				vProcessList[iProcessIDinList].AllocF( sAllocLine, sTime );
 				
 				// Subtests running?
 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
@@ -491,61 +412,23 @@
 				{
 					if( viSubTestIter->bRunning )
 					{
-						// Save alloc fragment also to sub test
-						// Add free fragment 
+						// Save realloc fragment also to sub test
 
-						// get 'free' line from realloc line
-						string sFreeRestOfLine = sRestOfLine;
-						string sFreeLine = "";
-						sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
-						sFreeLine.append( " " );
-						// next string is for 'alloc' (address) - lets remove it
-						GetStringUntilNextSpace( sFreeRestOfLine, true );
-						// add rest of line to 'free' line
-						sFreeLine.append( sFreeRestOfLine );
+						// Not used currently.
+						/*
 						//add 'free' line
-						vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
-
-						// Add alloc fragment
+						vProcessList[iProcessIDinList].FreeF( sFreeLine, sTime );
+						*/
 
-						// first string is for 'free' (address), lets remove it first
-						GetStringUntilNextSpace( sRestOfLine, true );
 						//add 'alloc' line
-						vProcessList[iProcessIDinList].AllocF( sRestOfLine, sTime );
+						vProcessList[iProcessIDinList].AllocF( sAllocLine, sTime );
 					}
 					viSubTestIter++;
 				}
 			}
-			// Command free
-			else if( ! _stricmp( pCommand, FREE_ID ) )
-			{
-				// Send free
-				vProcessList[iProcessIDinList].Free( sRestOfLine );
-
-				// Subtests running?
-				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
-				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
-				{
-					if( viSubTestIter->bRunning )
-					{
-						// Send free to subtest
-						viSubTestIter->Free( sRestOfLine );
-					}
-					viSubTestIter++;
-				}
-			}
-			// Header free.
+			// Free header
 			else if( ! _stricmp( pCommand, FREEH_ID ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				// Send free
 				vProcessList[iProcessIDinList].FreeH( sRestOfLine, sTime );
 
@@ -562,36 +445,20 @@
 				}
 			
 			}
+			// Free fragment
 			else if( ! _stricmp( pCommand, FREEF_ID ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
 				// Not used currently.
 			}
 			// Command process end
 			else if( ! _stricmp( pCommand, LABEL_PROCESS_END ) )
 			{
-				// append processID and time
+				// add processID and time
 				sWholeTempLine.append(" ");
 				sWholeTempLine.append( sProcessID );
 				sWholeTempLine.append(" ");
 				sWholeTempLine.append( sTime );
 
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				// Set process has ended.
 				vProcessList[iProcessIDinList].bProcessOnGoing = false;
 
@@ -670,34 +537,18 @@
 				vProcessList[iProcessIDinList].vSubTests.clear();
 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
 			}
+			// Handle leak
 			else if( ! _stricmp( pCommand, LABEL_HANDLE_LEAK ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				// Make whole line
 				sTemp.append( " " );
 				sTemp.append( sRestOfLine );
 				vProcessList[iProcessIDinList].vHandleLeaks.push_back( sTemp );
 			}
+			// Dll load
 			else if( ! _stricmp( pCommand, LABEL_DLL_LOAD ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
-				// append time to the end of the line
+				// add time
 				sWholeTempLine.append( " " );
 				sWholeTempLine.append( sTime );
 
@@ -712,18 +563,10 @@
 				}
 
 			}
+			// Dll unload
 			else if( ! _stricmp( pCommand, LABEL_DLL_UNLOAD ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
-				// append time to the end of the line
+				// add time
 				sWholeTempLine.append( " " );
 				sWholeTempLine.append( sTime );
 
@@ -741,28 +584,11 @@
 				     sTemp.find( LABEL_PROCESS_END ) != string::npos || sTemp.find( LABEL_ERROR_OCCURED ) != string::npos ||
 					 sTemp.find( LABEL_HANDLE_LEAK ) != string::npos )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
 			}
+			// Subtest start
 			else if( ! _stricmp( pCommand, LABEL_TEST_START ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				bRet = true; // Set return value true we found start.
 				// Get sub test time
 				string sSubTestTime = GetStringUntilNextSpace( sRestOfLine );
@@ -779,17 +605,9 @@
 
 				vProcessList[iProcessIDinList].vSubTests.push_back( SubTestData );
 			}
+			// Subtest end
 			else if( ! _stricmp( pCommand, LABEL_TEST_END ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				// Get sub test time
 				string sSubTestEnd = GetStringUntilNextSpace( sRestOfLine );
 				// Get sub test name
@@ -810,43 +628,19 @@
 					viSubTestIter++;
 				}
 			}
+			// Thread start
 			else if( ! _stricmp( pCommand, LABEL_THREAD_START ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				//currently not used
 			}
+			// Thread end
 			else if( ! _stricmp( pCommand, LABEL_THREAD_END ) )
 			{
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
-
 				//currently not used
 			}
 			else
 			{
-				// unknown tag, log it to cleaned file for carbide
-				if( bCreateCleanedTraces )
-				{
-				// add message to cleaned traces file
-				cleanedTraces << sTime << " "; //add time
-				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
-				cleanedTraces << sProcessID << " "; //add process ID
-				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
-				}
+				// unknown tag, only logged it to cleaned file for carbide
 			}
 		}
 	}
--- a/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfilelog.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/dynamicmemoryhook/src/analyzetoolfilelog.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -63,10 +63,12 @@
 {
     LOGSTR1( "ATFL CATFileLog::ATFileLogVersion()" );
     
+    TInt err( KErrNone );
+    
     iFile << KDataFileVersion;
 
-    iFile.CommitL();   
-    return KErrNone;
+    TRAP( err, iFile.CommitL() );
+    return err;
 }
 
 TInt RATFileLog::ATFileLogProcessStarted( const TDesC8& aProcessName,
@@ -77,6 +79,8 @@
 {
     LOGSTR1( "ATFL CATFileLog::ATFileLogProcessStarted()" );
  
+    TInt err( KErrNone );
+    
     // log the current time
     iFile << this->CurrentTime();
     
@@ -89,9 +93,9 @@
     iFile << aApiVersion;
     
     // ensure that any buffered data is written to the stream
-    iFile.CommitL();
+    TRAP( err, iFile.CommitL() );
     
-    return KErrNone;
+    return err;
 }
 
 // -----------------------------------------------------------------------------
@@ -102,7 +106,9 @@
 TInt RATFileLog::ATFileLogProcessEnded( TUint aHandleLeakCount )
 {
 	LOGSTR1( "ATFL CATFileLog::ATFileLogProcessEnded()" );
-	   
+	
+	TInt err( KErrNone );
+	
 	if ( aHandleLeakCount > 0 )
 	{
 		// HDL <Handle count>
@@ -118,9 +124,9 @@
 	iFile << (TUint8)EProcessEnd;
 	
     // ensure that any buffered data is written to the stream
-    iFile.CommitL();
+	TRAP( err, iFile.CommitL() );
 	
-	return KErrNone;	
+	return err;	
 }
 
 
@@ -133,7 +139,9 @@
                                 TUint32 aEndAddress )
 {
 	LOGSTR1( "ATFL CATFileLog::ATFileLogDllLoaded()" );
-	    
+	   
+	TInt err( KErrNone );
+	
 	// log the current time
 	iFile << this->CurrentTime();
 	
@@ -149,9 +157,9 @@
 	iFile << aEndAddress;
 	
 	// ensure that any buffered data is written to the stream
-	iFile.CommitL();
+	TRAP( err, iFile.CommitL() );
 	
-	return KErrNone;
+	return err;
 }
 
 
@@ -166,6 +174,8 @@
 {
     LOGSTR1( "ATFL CATFileLog::ATFileLogDllUnloaded()" );
 
+    TInt err( KErrNone );
+    
     // log the current time
     iFile << this->CurrentTime();
     
@@ -181,9 +191,9 @@
     iFile << aEndAddress;
     
     // ensure that any buffered data is written to the stream
-    iFile.CommitL();
+    TRAP( err, iFile.CommitL() );
 	
-	return KErrNone;
+	return err;
 		
 }
 
@@ -199,6 +209,8 @@
 {
 	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryAllocated()" );
 	
+	TInt err( KErrNone );
+	
 	// ALH <Memory address> <Allocation size> <Thread ID> 
 	// <Call stack address count> <Call stack address> <Call stack address> ...
 	
@@ -234,9 +246,9 @@
 		}
 
 	// ensure that any buffered data is written to the stream
-	iFile.CommitL();
+	TRAP( err, iFile.CommitL() );
 
-	return KErrNone;	
+	return err;	
 }
 
 
@@ -251,6 +263,8 @@
 {
     LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryFreed()" );
 	
+    TInt err( KErrNone );
+    
 	// FRH <Memory address> <Thread ID> <Call stack address count> 
 	// <Call stack address> <Call stack address> ...
 
@@ -287,9 +301,9 @@
 		}
 
 	// ensure that any buffered data is written to the stream
-	iFile.CommitL();
+	TRAP( err, iFile.CommitL() );
 
-	return KErrNone;		
+	return err;		
 }
 
 
@@ -303,7 +317,9 @@
                                   TInt aSize,  TUint aThreadId  )
 {
 	LOGSTR1( "ATFL CATFileLog::ATFileLogMemoryReallocated()" );    
-	    
+	   
+	TInt err( KErrNone );
+	
 	// RAH <Freed memory address> <Allocated memory address> <Allocation size> <Thread ID>
 	// <Call stack address count> <Call stack address> <Call stack address> ...
 	        
@@ -342,9 +358,9 @@
 		}
 
 	// ensure that any buffered data is written to the stream
-	iFile.CommitL();
+	TRAP( err, iFile.CommitL() );
 
-	return KErrNone;	
+	return err;	
 }
 
 
@@ -357,6 +373,8 @@
 {
 	LOGSTR1( "ATFL CATFileLog::ATFileLogThreadStarted()" );
 
+	TInt err( KErrNone );
+	
 	// log the current time
 	iFile << this->CurrentTime();
 	
@@ -368,9 +386,9 @@
 	iFile << (TUint32)aThreadId;
     
     // ensure that any buffered data is written to the stream
-    iFile.CommitL();
+	TRAP( err, iFile.CommitL() );
 
-	return KErrNone;
+	return err;
 }
 
 
@@ -381,22 +399,24 @@
 // 
 TInt RATFileLog::ATFileLogThreadEnded( TUint64 aThreadId )
 {
-	  LOGSTR1( "ATFL CATFileLog::ATFileLogThreadEnded()" );
-
-		// log the current time
-		iFile << this->CurrentTime();
-		
-		// TDE <Thread ID>
-
-		// TDE
-		iFile << (TUint8)EThreadEnd;
-		// thread ID
-		iFile << (TUint32)aThreadId;
-	    
-	    // ensure that any buffered data is written to the stream
-	    iFile.CommitL();
-
-		return KErrNone;
+    LOGSTR1( "ATFL CATFileLog::ATFileLogThreadEnded()" );
+    
+    TInt err( KErrNone );
+    
+    // log the current time
+    iFile << this->CurrentTime();
+    
+    // TDE <Thread ID>
+    
+    // TDE
+    iFile << (TUint8)EThreadEnd;
+    // thread ID
+    iFile << (TUint32)aThreadId;
+    
+    // ensure that any buffered data is written to the stream
+    TRAP( err, iFile.CommitL() );
+    
+    return err;
 }
 
 
@@ -410,6 +430,8 @@
 {
     LOGSTR1( "ATFL CATFileLog::ATFileLogVersionsInfo()" );
 
+    TInt err( KErrNone );
+    
     // log the current time
     iFile << this->CurrentTime();
 
@@ -421,9 +443,9 @@
     iFile << aChecksum;
 
     // ensure that any buffered data is written to the stream
-    iFile.CommitL();
+    TRAP( err, iFile.CommitL() );
 
-	return KErrNone;	
+	return err;	
 }
 
 
--- a/perfsrv/analyzetool/group/ReleaseNotes_AnalyzeTool.txt	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/group/ReleaseNotes_AnalyzeTool.txt	Mon Oct 04 02:45:59 2010 +0300
@@ -1,7 +1,7 @@
 ===============================================================================
 
-RELEASE NOTES - ANALYZETOOL v1.10.0
-RELEASED 2nd July 2010
+RELEASE NOTES - ANALYZETOOL v1.10.1
+RELEASED 7th September 2010
 
 SUPPORTS SYMBIAN^1+
 
@@ -21,13 +21,12 @@
 ===============================================================================
 
 
-What's New in v1.10.0
+What's New in v1.10.1
 ====================
-  
-- Change: Storage server was removed
-- Change: New trace format
-- Change: Logging to binary file added
-- Change: Capture of reallocations implemented
+
+- Fix: Wrong memory addresses in analyze output for subtests
+- Fix: Commandline engine fixes
+- Change: Reallocations support for Carbide
 
 ===============================================================================
 
@@ -110,6 +109,17 @@
 Version History:
 ================
 
+
+Version 1.10.0 - 2nd July 2010
+==============================
+  
+- Change: Storage server was removed
+- Change: New trace format
+- Change: Logging to binary file added
+- Change: Capture of reallocations implemented
+
+===============================================================================
+
 Version 1.9.1 - 29th April 2010
 ==============================
 - Change: Removed Avkon and Console UI's to simplify the maintenance of the
--- a/perfsrv/analyzetool/kerneleventhandler/src/analyzetooleventhandler.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/kerneleventhandler/src/analyzetooleventhandler.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -333,14 +333,14 @@
     // Aqcuire the data mutex
     Kern::MutexWait( *iDataMutex );
     
-    aInfo.iProcessId = aThread->iOwningProcess->iId;
-    TBool alone( aThread->iOwningProcess->iThreadQ.First()->Alone() );
-    LOGSTR2( "ATDD > Is alone = %d", alone );
-    
-    // Check if this our process and is the only thread item.
-    if ( aInfo.iProcessId == iProcessId && !alone )
+    if ( aThread )
         {
-        if ( aThread )
+        aInfo.iProcessId = aThread->iOwningProcess->iId;
+        TBool alone( aThread->iOwningProcess->iThreadQ.First()->Alone() );
+        LOGSTR2( "ATDD > Is alone = %d", alone );
+        
+        // Check if this our process and is the only thread item.
+        if ( aInfo.iProcessId == iProcessId && !alone )
             {
             // Set current Thread id
             LOGSTR2( "ATDD > Thread ID = %d", aThread->iId );
--- a/perfsrv/analyzetool/sis/AnalyzeTool.pkg	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/sis/AnalyzeTool.pkg	Mon Oct 04 02:45:59 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; standard SIS file header
-#{"AnalyzeTool"},(0x20012432),1,10,0,TYPE=SA, RU
+#{"AnalyzeTool"},(0x20012432),1,10,1,TYPE=SA, RU
 
 ;Localised Vendor name
 %{"Nokia Corporation"}
--- a/perfsrv/analyzetool/sis/AnalyzeTool_udeb.pkg	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/sis/AnalyzeTool_udeb.pkg	Mon Oct 04 02:45:59 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; standard SIS file header
-#{"AnalyzeTool"},(0x20012432),1,10,0,TYPE=SA, RU
+#{"AnalyzeTool"},(0x20012432),1,10,1,TYPE=SA, RU
 
 ;Localised Vendor name
 %{"Nokia Corporation"}
--- a/perfsrv/analyzetool/sis/analyzeTool_stub.pkg	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/analyzetool/sis/analyzeTool_stub.pkg	Mon Oct 04 02:45:59 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ;Header
-#{"AnalyzeTool"}, (0x20012432), 1,10,0
+#{"AnalyzeTool"}, (0x20012432), 1,10,1
 
 ; Non-localised vendor name
 :"Nokia Corporation"
--- a/perfsrv/memspy/CommandLine/Source/MemSpyCommandLine.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/CommandLine/Source/MemSpyCommandLine.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -1,19 +1,19 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 
 #include "MemSpyCommandLine.h"
 
@@ -28,142 +28,140 @@
 #include "MemSpyCommands.h"
 
 /*
-CMemSpyCommandLine::CMemSpyCommandLine()
-    {	
-    }
-*/
+ CMemSpyCommandLine::CMemSpyCommandLine()
+ {	
+ }
+ */
 
 CMemSpyCommandLine::CMemSpyCommandLine( CConsoleBase& aConsole )
-	: CActive( EPriorityHigh ), iConsole( aConsole )
-    {	
-	CActiveScheduler::Add( this );
-    }
+	 :CActive(EPriorityHigh), iConsole(aConsole)
+	{
+	CActiveScheduler::Add(this);
+	}
 
 CMemSpyCommandLine::~CMemSpyCommandLine()
-    {
+	{
 	Cancel();
-	
-    if ( iMemSpySession )
-        {
-        iMemSpySession->Close();
-        }
-    delete iMemSpySession;
-    iFsSession.Close();
-    }
 
+	if (iMemSpySession)
+		{
+		iMemSpySession->Close();
+		}
+	delete iMemSpySession;
+	iFsSession.Close();
+	}
 
 void CMemSpyCommandLine::ConstructL()
-    {
-    User::LeaveIfError( iFsSession.Connect() );   
-    iMemSpySession = new(ELeave) RMemSpySession();
-    ConnectToMemSpyL();                    
-    }
+	{
+	User::LeaveIfError(iFsSession.Connect());
+	iMemSpySession = new (ELeave) RMemSpySession();
+	ConnectToMemSpyL();
+	}
 
-CMemSpyCommandLine* CMemSpyCommandLine::NewLC( CConsoleBase& aConsole )
-    {
-    CMemSpyCommandLine* self = new(ELeave) CMemSpyCommandLine( aConsole );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
+CMemSpyCommandLine* CMemSpyCommandLine::NewLC(CConsoleBase& aConsole)
+	{
+	CMemSpyCommandLine* self = new (ELeave) CMemSpyCommandLine(aConsole);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
 
-void CMemSpyCommandLine::PerformOpL( const CCommandLineArguments& aCommandLine )
-    {
-    const TInt count = aCommandLine.Count();
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - START - arg count: %d, this: 0x%08x", count, this ) );
+void CMemSpyCommandLine::PerformOpL(const CCommandLineArguments& aCommandLine)
+	{
+	const TInt count = aCommandLine.Count();
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformOpL() - START - arg count: %d, this: 0x%08x", count, this ) );
 
-    if  ( count >= 1 )
-        {
-        // Get main command
-        TBuf<KMemSpyCommandLineMaxLength> command;
-        command.Copy( aCommandLine.Arg( 1 ) );
-        command.UpperCase();
+	if (count >= 1)
+		{
+		// Get main command
+		TBuf<KMemSpyCommandLineMaxLength> command;
+		command.Copy(aCommandLine.Arg(1));
+		command.UpperCase();
 
-        // Extract arguments into array
-        CDesCArrayFlat* args = new(ELeave) CDesCArrayFlat(4);
-        CleanupStack::PushL( args );
-        for( TInt i=2; i<count; i++ )
-            {
-            args->AppendL( aCommandLine.Arg( i ) );
-            }
+		// Extract arguments into array
+		CDesCArrayFlat* args = new (ELeave) CDesCArrayFlat(4);
+		CleanupStack::PushL(args);
+		for (TInt i = 2; i < count; i++)
+			{
+			args->AppendL(aCommandLine.Arg(i));
+			}
 
-        // Perform op
-        PerformSingleOpL( command, *args );
+		// Perform op
+		PerformSingleOpL(command, *args);
 
-        // Tidy up
-        CleanupStack::PopAndDestroy( args );
-        }
-    else
-        {
-        User::Leave( KErrUnderflow );
-        }
-    }
+		// Tidy up
+		CleanupStack::PopAndDestroy(args);
+		}
+	else
+		{
+		User::Leave(KErrUnderflow);
+		}
+	}
 
-
-void CMemSpyCommandLine::PerformSingleOpL( const TDesC& aCommand, const CDesCArray& aParameters )
-    {
-    // Record duration
-    TTime timeStart; 
-    timeStart.HomeTime();
-    const TInt paramCount = aParameters.Count();
+void CMemSpyCommandLine::PerformSingleOpL(const TDesC& aCommand, const CDesCArray& aParameters)
+	{
+	// Record duration
+	TTime timeStart;
+	timeStart.HomeTime();
+	const TInt paramCount = aParameters.Count();
 
 #ifdef _DEBUG
-    TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - START - command: %S, paramCount: %d, this: 0x%08x"), &aCommand, paramCount, this ) );
-    for( TInt i=0; i<paramCount; i++ )
-        {
-        const TPtrC pParam( aParameters[ i ] );
-        TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - param[%02d] = [%S]"), i, &pParam ) );
-        }
+	TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - START - command: %S, paramCount: %d, this: 0x%08x"), &aCommand, paramCount, this ) );
+	for (TInt i = 0; i < paramCount; i++)
+		{
+		const TPtrC pParam(aParameters[i]);
+		TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - param[%02d] = [%S]"), i, &pParam ) );
+		}
 #else
-    RDebug::Print( _L("[MemSpyCmdLine] COMMAND: [%S] {%02d}..."), &aCommand, paramCount );
+	RDebug::Print( _L("[MemSpyCmdLine] COMMAND: [%S] {%02d}..."), &aCommand, paramCount );
 #endif
 
-    TFileName batchFile;
-    batchFile.Append( aCommand );
-    
-    TInt err = KErrNotSupported;
-    TInt error = KErrNotSupported;
-    
-    // --- HELP
-    if ( aCommand.CompareF( KMemSpyCmdHelp1) == 0 || 
-    	 aCommand.CompareF( KMemSpyCmdHelp2) == 0 ||
-    	 aCommand.CompareF( KMemSpyCmdHelp3) == 0 ||
-    	 aCommand.CompareF( KMemSpyCmdHelp4) == 0 )
-    	{
-		iConsole.Write( KHelpMessage );
-		iConsole.Write( KMemSpyCLINewLine );		
-		iConsole.Write( KHelpOutputCommand );
-		iConsole.Write( KHelpOutputToFileCommand );
-		iConsole.Write( KHelpHeapDumpCommand );
-		iConsole.Write( KHelpSwmtCommand );
-		iConsole.Write( KHelpKillServerCommand );
-		iConsole.Write( KMemSpyCLINewLine );
-		iConsole.Write( KHelpCommand );
+	TFileName batchFile;
+	batchFile.Append(aCommand);
+
+	TInt err = KErrNotSupported;
+	TInt error = KErrNotSupported;
 
-	    // Show input prompt.
-	    iCommandPromptPos = iConsole.CursorPos();
-	    RedrawInputPrompt();
-	    WaitForInput();
-	    
-	    CActiveScheduler::Start();
-    	}
-    // --- OUTPUT
-    //TODO: directory option to be added
-    else if  ( aCommand.CompareF( KMemSpyCmdOutput ) == 0 )	//change output mode   
-    	{    						
-		if( paramCount >= 1 )
+	// --- HELP
+	if ( aCommand.CompareF( KMemSpyCmdHelp1) == 0 || 
+		aCommand.CompareF(KMemSpyCmdHelp2) == 0 || 
+		aCommand.CompareF(KMemSpyCmdHelp3) == 0 || 
+		aCommand.CompareF(KMemSpyCmdHelp4) == 0)
+		{
+		iConsole.Write(KHelpMessage);
+		iConsole.Write(KMemSpyCLINewLine);
+		iConsole.Write(KHelpOutputCommand);
+		iConsole.Write(KHelpOutputToFileCommand);
+		iConsole.Write(KHelpHeapDumpCommand);
+		iConsole.Write(KHelpSwmtCommand);
+		iConsole.Write(KHelpKillServerCommand);
+		iConsole.Write(KMemSpyCLINewLine);
+		iConsole.Write(KHelpCommand);
+
+		// Show input prompt.
+		iCommandPromptPos = iConsole.CursorPos();
+		RedrawInputPrompt();
+		WaitForInput();
+
+		CActiveScheduler::Start();
+		}
+	// --- OUTPUT
+	//TODO: directory option to be added
+	else if (aCommand.CompareF(KMemSpyCmdOutput) == 0) //change output mode   
+		{
+		if (paramCount >= 1)
 			{
-			if( aParameters[0].CompareF( KMemSpyCmdOutputParameterFile ) == 0 )
+			if (aParameters[0].CompareF(KMemSpyCmdOutputParameterFile) == 0)
 				{
-				if( paramCount == 2 )
+				if (paramCount == 2)
 					{
 					TBuf<KMaxFileName> directory;
-					directory.Copy( aParameters[1] );
-					iMemSpySession->SwitchOutputToFileL( directory );
+					directory.Copy(aParameters[1]);
+					iMemSpySession->SwitchOutputToFileL(directory);
 					}
 				else
 					{
-					iMemSpySession->SwitchOutputToFileL( KNullDesC );
+					iMemSpySession->SwitchOutputToFileL(KNullDesC);
 					}
 				}
 			else if( aParameters[0].CompareF( KMemSpyCmdOutputParameterTrace ) == 0)
@@ -171,27 +169,27 @@
 				TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Output Trace", this ) );
 				iMemSpySession->SwitchOutputToTraceL();
 				}
-			}		           
-    	}    	
-    // --- HEAP DUMP    
-    else if ( aCommand.CompareF( KMemSpyCmdHeapDump) == 0 )    	
-		{		
-		RedrawStatusMessage( KHeapDumpMessage );
-		
-		if( paramCount == 0 ) // no parameter - dump all heap data + kernel heap at the end
-			{		
-		
-			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (all threads)", this ) );			
+			}
+		}
+	// --- HEAP DUMP    
+	else if (aCommand.CompareF(KMemSpyCmdHeapDump) == 0)
+		{
+		RedrawStatusMessage(KHeapDumpMessage);
+
+		if (paramCount == 0) // no parameter - dump all heap data + kernel heap at the end
+			{
+
+			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (all threads)", this ) );
 			// Dump heap data for all threads - Thread agnostic operation					
 			iMemSpySession->OutputHeapData();
 			// Dump kernel heap data
 			iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel );					
 			}
-		else if( paramCount >= 1)
+		else if (paramCount >= 1)
 			{
-			if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterAll ) == 0 )
+			if (aParameters[0].CompareF(KMemSpyCmdHeapDumpParameterAll) == 0)
 				{
-				iMemSpySession->OutputHeapData();				
+				iMemSpySession->OutputHeapData();
 				iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel );				
 				}
 			else if( aParameters[0].CompareF( KMemSpyCmdHeapDumpParameterKernel ) == 0 )
@@ -200,499 +198,508 @@
 				iMemSpySession->OutputThreadHeapDataL( KMemSpyClientServerThreadIdKernel );				
 				}
 			else
-				{				
+				{
 				// Dump heap data for named thread - filter
-				const TPtrC pThreadName( aParameters[0] );
-				TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (%S)"), this, &pThreadName ) );				
-				iMemSpySession->OutputThreadHeapDataL( pThreadName );
+				const TPtrC pThreadName(aParameters[0]);
+				TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - Heap_Dump (%S)"), this, &pThreadName ) );
+				iMemSpySession->OutputThreadHeapDataL(pThreadName);
 				}
-  			}
+			}
 		}
-    
-    // --- SYSTEM WIDE MEMORY TRACKING    
-    else if( aCommand.CompareF( KMemSpyCmdSwmt ) == 0 )
-    	{    
-		RedrawStatusMessage( KSWMTMessage );
-    		
-		TInt categories( 0 );
+
+	// --- SYSTEM WIDE MEMORY TRACKING    
+	else if (aCommand.CompareF(KMemSpyCmdSwmt) == 0)
+		{
+		RedrawStatusMessage(KSWMTMessage);
+
+		TInt categories(0);
 		TName threadNameFilter;
-		
-		if( paramCount == 0 ) //default state -> "dumpnow" command with "all" categories
+
+		if (paramCount == 0) //default state -> "dumpnow" command with "all" categories
 			{
 			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - this: 0x%08x - dumpnow command", this ) );
 			TInt category = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
-			iMemSpySession->SetSwmtCategoriesL( category );			
-			iMemSpySession->ForceSwmtUpdateL();			
+			iMemSpySession->SetSwmtCategoriesL(category);
+			iMemSpySession->ForceSwmtUpdateL();
 			}
-		else if( paramCount >= 1)
+		else if (paramCount >= 1)
 			{
-			const TPtrC pParam( aParameters[0] );
-			if( pParam.CompareF( KMemSpyCmdSwmtParameterStarttimer) == 0 ) // "starttimer" - start tracking
+			const TPtrC pParam(aParameters[0]);
+			if (pParam.CompareF(KMemSpyCmdSwmtParameterStarttimer) == 0) // "starttimer" - start tracking
 				{
 				TInt result(0);
 				categories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
-				iMemSpySession->SetSwmtTimerIntervalL( KMemSpySysMemTrackerConfigMinTimerPeriod );
-				
-				if( paramCount >= 2 ) // user gave some optional parameters - <categories> or <value in seconds>
-					{					
-					TLex lex( aParameters[1] );
-				    if ( lex.Val( result ) == KErrNone ) //if 2nd parameter is not number, then parse parameters
-				    	{
+				iMemSpySession->SetSwmtTimerIntervalL(KMemSpySysMemTrackerConfigMinTimerPeriod);
+
+				if (paramCount >= 2) // user gave some optional parameters - <categories> or <value in seconds>
+					{
+					TLex lex(aParameters[1]);
+					if (lex.Val(result) == KErrNone) //if 2nd parameter is not number, then parse parameters
+						{
 						if( result >= KMemSpySysMemTrackerConfigMinTimerPeriod && result <= KMemSpySysMemTrackerConfigMaxTimerPeriod )
 							{
-							iMemSpySession->SetSwmtTimerIntervalL( result );							;
-							}											
-				    	}				   
-				    TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
-					}																				
-				
+							iMemSpySession->SetSwmtTimerIntervalL( result );							
+							}
+						}
+					TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
+					}
+
 				//if( !err )
 				//	{
-					/*
-					_LIT( KPressS, "Press 's' to stop the timer " );
-					iConsole.Write( KPressS );
-					
-					iCommandPromptPos = iConsole.CursorPos();					
-					RedrawInputPrompt();					
-					WaitForInput();
-					*/
-					    
-					iMemSpySession->StartSwmtTimerL();
-					
-					//CActiveScheduler::Start();									
+				/*
+				 _LIT( KPressS, "Press 's' to stop the timer " );
+				 iConsole.Write( KPressS );
+				 
+				 iCommandPromptPos = iConsole.CursorPos();					
+				 RedrawInputPrompt();					
+				 WaitForInput();
+				 */
+
+				iMemSpySession->StartSwmtTimerL();
+
+				//CActiveScheduler::Start();									
 				//	}	
 				}
-			else if( pParam.CompareF( KMemSpyCmdSwmtParameterStoptimer) == 0 ) // "stoptime" - stop tracking
+			else if (pParam.CompareF(KMemSpyCmdSwmtParameterStoptimer) == 0) // "stoptime" - stop tracking
 				{
 				iMemSpySession->StopSwmtTimerL();
 				}
-			else if( pParam.CompareF( KMemSpyCmdSwmtParameterDumpnow ) == 0 ) // "dumpnow" - runs one tracking cycle (CmdSWMT_ForceUpdate before)
+			else if (pParam.CompareF(KMemSpyCmdSwmtParameterDumpnow) == 0) // "dumpnow" - runs one tracking cycle (CmdSWMT_ForceUpdate before)
 				{
 				categories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
-				if( paramCount >= 2 ) // user gave some optional parameters - <categories>
+				if (paramCount >= 2) // user gave some optional parameters - <categories>
 					{
 					TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
-					}				
-																
-				if( !err )
+					}
+
+				if (!err)
 					{
-					iMemSpySession->SetSwmtCategoriesL( categories );
+					iMemSpySession->SetSwmtCategoriesL(categories);
 					iMemSpySession->ForceSwmtUpdateL();
-					}												
-				}							
+					}
+				}
 			else //no parameters ("starttimer / stoptimer / dumpnow"), just categories / thread filter
-				 //so dumpnow is used as default with category / thread specified
+			//so dumpnow is used as default with category / thread specified
 				{
 				TRAP( err, ParseSWMTParametersL( aParameters, categories, threadNameFilter) );
-				if( !err )
+				if (!err)
 					{
-					iMemSpySession->SetSwmtCategoriesL( categories );
-					if( threadNameFilter.Length() > 0 )
+					iMemSpySession->SetSwmtCategoriesL(categories);
+					if (threadNameFilter.Length() > 0)
 						{
-						iMemSpySession->SetSwmtFilter( threadNameFilter );
+						iMemSpySession->SetSwmtFilter(threadNameFilter);
 						}
-					}								
-					iMemSpySession->ForceSwmtUpdateL();				
+					}
+				iMemSpySession->ForceSwmtUpdateL();
 				}
 			}
-    	}
-    // --- KILL SERVER
-    else if ( aCommand.CompareF( KMemSpyCmdKillServer ) == 0 )
-    	{    
-    	}
-    
-   // RedrawStatusMessage();   
-    
-    TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - END - err: %d, this: 0x%08x, cmd: %S" ), err, this, &aCommand ) );
+		}
+	// --- KILL SERVER
+	else if (aCommand.CompareF(KMemSpyCmdKillServer) == 0)
+		{
+		}
+
+	// RedrawStatusMessage();   
+
+	TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::PerformSingleOpL() - END - err: %d, this: 0x%08x, cmd: %S" ), err, this, &aCommand ) );
 
-    // Calculate duration
-    TTime timeEnd;
-    timeEnd.HomeTime();
-    TTimeIntervalSeconds interval( 0 );
-    timeEnd.SecondsFrom( timeStart, interval );
+	// Calculate duration
+	TTime timeEnd;
+	timeEnd.HomeTime();
+	TTimeIntervalSeconds interval(0);
+	timeEnd.SecondsFrom(timeStart, interval);
 
-    // Print some info
-    if  ( err != KErrNone )
-        {
-        RDebug::Print( _L("[MemSpyCmdLine] COMMAND: [%S] {%02d} {%08d sec} => ERROR: %d"), &aCommand, paramCount, interval.Int(), err );
-        }
-    else
-        {
-        RDebug::Print( _L("[MemSpyCmdLine] COMMAND: [%S] {%02d} {%08d sec} => OK"), &aCommand, paramCount, interval.Int() );
-        }
+	// Print some info
+	if (err != KErrNone)
+		{
+		RDebug::Print( _L("[MemSpyCmdLine] COMMAND: [%S] {%02d} {%08d sec} => ERROR: %d"), &aCommand, paramCount, interval.Int(), err );
+		}
+	else
+		{
+		RDebug::Print( _L("[MemSpyCmdLine] COMMAND: [%S] {%02d} {%08d sec} => OK"), &aCommand, paramCount, interval.Int() );
+		}
 
-    // Spacer
-    RDebug::Printf( " " );
-    }
-
+	// Spacer
+	RDebug::Printf(" ");
+	}
 
 void CMemSpyCommandLine::ConnectToMemSpyL()
-    {
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - START - this: 0x%08x", this ) );
+	{
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - START - this: 0x%08x", this ) );
 
-    TInt err = iMemSpySession->Connect();
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - connect #1 err: %d, this: 0x%08x", err, this ) );
+	TInt err = iMemSpySession->Connect();
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - connect #1 err: %d, this: 0x%08x", err, this ) );
 
-    if  ( err == KErrNotFound )
-        {
-        TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - launching MemSpy... - this: 0x%08x", this ) );
-        LaunchMemSpyL();
+	if (err == KErrNotFound)
+		{
+		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - launching MemSpy... - this: 0x%08x", this ) );
+		LaunchMemSpyL();
 
-        TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - launched MemSpy - this: 0x%08x", this ) );
-        err = iMemSpy->Connect();
-
-        TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - connect #2 err: %d, this: 0x%08x", err, this ) );
-        }
+		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - launched MemSpy - this: 0x%08x", this ) );
+		err = iMemSpy->Connect();
 
-    User::LeaveIfError( err );
+		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - connect #2 err: %d, this: 0x%08x", err, this ) );
+		}
 
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - END - ok - this: 0x%08x", this ) );
-    }
+	User::LeaveIfError(err);
 
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ConnectToMemSpyL() - END - ok - this: 0x%08x", this ) );
+	}
 
 void CMemSpyCommandLine::LaunchMemSpyL()
-    {
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - START - this: 0x%08x", this ) );
+	{
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - START - this: 0x%08x", this ) );
 
-    TInt err = KErrGeneral;
-    RProcess proc;
-    
-    // Try to run server first
-    err = proc.Create( KMemSpyProcessName0, KNullDesC );
-    if ( err == KErrNone )
-    	{
+	TInt err = KErrGeneral;
+	RProcess proc;
+
+	// Try to run server first
+	err = proc.Create(KMemSpyProcessName0, KNullDesC);
+	if (err == KErrNone)
+		{
 		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Create server process successfully... - this: 0x%08x", this ) );
 
 		TRequestStatus status;
-		proc.Rendezvous( status );
+		proc.Rendezvous(status);
 		proc.Resume();
 
 		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) );
 
-		User::WaitForRequest( status );
+		User::WaitForRequest(status);
 		err = status.Int();
 		proc.Close();
 
 		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Rendezvous complete: %d, this: 0x%08x", err, this ) );
-    	}
+		}
 
-    // If server is not available, try with s60 UI
-    if ( err != KErrNone )
-    	{
-		err = proc.Create( KMemSpyProcessName1, KNullDesC );
-		if  ( err == KErrNone )
+	// If server is not available, try with s60 UI
+	if (err != KErrNone)
+		{
+		err = proc.Create(KMemSpyProcessName1, KNullDesC);
+		if (err == KErrNone)
 			{
 			TFullName fullName;
-			proc.FullName( fullName );
+			proc.FullName(fullName);
 			TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Create S60 UI process successfully... - this: 0x%08x, name: %S"), this, &fullName ) );
-	
+
 			TRequestStatus status;
-			proc.Rendezvous( status );
+			proc.Rendezvous(status);
 			proc.Resume();
-	
+
 			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) );
-			User::WaitForRequest( status );
+			User::WaitForRequest(status);
 			err = status.Int();
 			proc.Close();
-	
+
 			TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Rendezvous complete: %d, this: 0x%08x", err, this ) );
 			}
-    	}
+		}
+
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - final error: %d, this: 0x%08x", err, this ) );
+	User::LeaveIfError(err);
+	User::After(10 * 1000000);
 
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - final error: %d, this: 0x%08x", err, this ) );
-    User::LeaveIfError( err );
-    User::After( 10 * 1000000 );
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - END - ok - this: 0x%08x", this ) );
+	}
 
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - END - ok - this: 0x%08x", this ) );
-    }
-
+CDesCArray* CMemSpyCommandLine::ReadLinesL(RFile& aFile)
+	{
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - START - this: 0x%08x", this ) );
+	CDesCArrayFlat* lines = new (ELeave) CDesCArrayFlat(10);
+	CleanupStack::PushL(lines);
 
-CDesCArray* CMemSpyCommandLine::ReadLinesL( RFile& aFile )
-    {
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - START - this: 0x%08x", this ) );
-    CDesCArrayFlat* lines = new(ELeave) CDesCArrayFlat( 10 );
-    CleanupStack::PushL( lines );
-
-    TInt size = 0;
-    User::LeaveIfError( aFile.Size( size ) );
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x, file size: %d", this, size ) );
+	TInt size = 0;
+	User::LeaveIfError(aFile.Size(size));
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x, file size: %d", this, size ) );
 
-    // Read file
-    HBufC8* narrowBuf = HBufC8::NewLC( size );
-    TPtr8 pBufNarrow( narrowBuf->Des() );
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x, reading file..." ) );
-    User::LeaveIfError( aFile.Read( pBufNarrow ) );
-    if  ( pBufNarrow.Length() <= 2 )
-        {
-        TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - BAD FILE LENGTH", this ) );
-        User::Leave( KErrCorrupt );
-        }
+	// Read file
+	HBufC8* narrowBuf = HBufC8::NewLC(size);
+	TPtr8 pBufNarrow(narrowBuf->Des());
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x, reading file..." ) );
+	User::LeaveIfError(aFile.Read(pBufNarrow));
+	if (pBufNarrow.Length() <= 2)
+		{
+		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - BAD FILE LENGTH", this ) );
+		User::Leave(KErrCorrupt);
+		}
 
-    // Look for BOM and convert to unicode
-    HBufC* unicodeText = HBufC::NewL( size );
-    TPtr pUnicodeText( unicodeText->Des() );
-    if  ( pBufNarrow[0] == 0xFF && pBufNarrow[1] == 0xFE )
-        {
-        // It's unicode... and we don't want the BOM, hence -2
-        const TInt textLength = size - 2;
-        TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - UNICODE TEXT - textLength: %d", this, textLength / 2 ) );
-        Mem::Copy( (TUint8 *)pUnicodeText.Ptr(), pBufNarrow.Ptr() + 2, textLength );
-        pUnicodeText.SetLength( textLength / 2 );
-        }
-    else
-        {
-        // It's ASCII, convert it to unicode...
-        TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - ASCII TEXT - textLength: %d", this, size ) );
-        for (TInt i = 0; i<size; i++ )
-            {
-            pUnicodeText.Append( pBufNarrow[ i ] );
-            }
-        }
+	// Look for BOM and convert to unicode
+	HBufC* unicodeText = HBufC::NewL(size);
+	TPtr pUnicodeText(unicodeText->Des());
+	if (pBufNarrow[0] == 0xFF && pBufNarrow[1] == 0xFE)
+		{
+		// It's unicode... and we don't want the BOM, hence -2
+		const TInt textLength = size - 2;
+		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - UNICODE TEXT - textLength: %d", this, textLength / 2 ) );
+		Mem::Copy( (TUint8 *)pUnicodeText.Ptr(), pBufNarrow.Ptr() + 2, textLength );
+		pUnicodeText.SetLength(textLength / 2);
+		}
+	else
+		{
+		// It's ASCII, convert it to unicode...
+		TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - ASCII TEXT - textLength: %d", this, size ) );
+		for (TInt i = 0; i < size; i++)
+			{
+			pUnicodeText.Append(pBufNarrow[i]);
+			}
+		}
 
-    // Discard old narrow text
-    CleanupStack::PopAndDestroy( narrowBuf );
-    CleanupStack::PushL( unicodeText );
+	// Discard old narrow text
+	CleanupStack::PopAndDestroy(narrowBuf);
+	CleanupStack::PushL(unicodeText);
 
-    // Try to extract lines of text...
-    HBufC* line = HBufC::NewLC( 1024 );
-    TPtr pLine( line->Des() );
-    const TInt length = unicodeText->Length();
-    for( TInt i=0; i<length; i++ )
-        {
-        const TChar c( pUnicodeText[ i ] );
-        //
-        if  ( c == '\r' || c == '\n' )
-            {
-            pLine.Trim();
-            if  ( pLine.Length() )
-                {
-                TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - LINE[%03d] %S"), this, lines->Count(), line ) );
-                lines->AppendL( pLine );
-                }
+	// Try to extract lines of text...
+	HBufC* line = HBufC::NewLC(1024);
+	TPtr pLine(line->Des());
+	const TInt length = unicodeText->Length();
+	for (TInt i = 0; i < length; i++)
+		{
+		const TChar c(pUnicodeText[i]);
+		//
+		if (c == '\r' || c == '\n')
+			{
+			pLine.Trim();
+			if (pLine.Length())
+				{
+				TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - LINE[%03d] %S"), this, lines->Count(), line ) );
+				lines->AppendL(pLine);
+				}
 
-            pLine.Zero();
-            }
-        else
-            {
-            pLine.Append( c );
-            }
-        }
+			pLine.Zero();
+			}
+		else
+			{
+			pLine.Append(c);
+			}
+		}
 
-    // Save last line, just in cae it didn't end with a CR/LF
-    pLine.Trim();
-    if ( pLine.Length() )
-        {
-        TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - LINE[%03d] %S"), this, lines->Count(), line ) );
-        lines->AppendL( pLine );
-        }
+	// Save last line, just in cae it didn't end with a CR/LF
+	pLine.Trim();
+	if (pLine.Length())
+		{
+		TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - this: 0x%08x - LINE[%03d] %S"), this, lines->Count(), line ) );
+		lines->AppendL(pLine);
+		}
 
-    CleanupStack::PopAndDestroy( 2, unicodeText ); // line & unicodeText
-    CleanupStack::Pop( lines );
-    TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - END - this: 0x%08x", this ) );
+	CleanupStack::PopAndDestroy(2, unicodeText); // line & unicodeText
+	CleanupStack::Pop(lines);
+	TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::ReadLinesL() - END - this: 0x%08x", this ) );
 
-    return lines;
-    }
+	return lines;
+	}
 
+void CMemSpyCommandLine::ParseSWMTParametersL(const CDesCArray& aParameters,TInt& aCategories, TDes& aFilter)
+	{
+	TInt result(0);
+	// Check if the first parameter is a number.
+	// In that case other parameters are ignored.
+	TLex lex(aParameters[0]);
+	if (lex.Val(result) != KErrNone)
+		{
+		// Parameters were given in text form:
+		const TInt count(aParameters.Count());
+		for (TInt i = 0; i < count; i++)
+			{
+			lex = aParameters[i]; //check if num.
+			if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeHeap) == 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap;
+			//| TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeChunk) == 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks
+								| TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeCode) == 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode;
+			//else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeStack) == 0)
+			//	result
+			//			|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks;
+			//else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeGlobalData ) == 0 )
+			//    result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeRamDrive) == 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeOpenFile) == 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeDiskSpace) == 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage;
+			//else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeFbserv ) == 0 ) // enables both FABS and BITM 
+			//    result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeHandleGeneric)
+					== 0) // enables both HGEN and HPAS
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeFileServerCache)
+					== 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeSystemMemory)
+					== 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeWindowGroup)
+					== 0)
+				result
+						|= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups;
+			else if (aParameters[i].CompareF(KMemSpyCmdSWMTTypeAll) == 0) //"all" category added
+				result
+						= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
+			else if (aParameters[i].CompareF(KMemSpyCmdSwmtParameterDumpnow)
+					== 0 || aParameters[i].CompareF(
+					KMemSpyCmdSwmtParameterStarttimer) == 0
+					|| aParameters[i].CompareF(KMemSpyCmdSwmtParameterStoptimer)
+							== 0)
+				{
+				TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine:: command parameter") );
+				}
+			else if (lex.Val(result) == KErrNone)
+				{
+				TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine:: number - timer period") );
+				}
+			else// if ( aParameters[i].Find( KMemSpyCmdSWMTTypeHeapFilter ) == 0 )
+				{
+				aFilter.Copy(aParameters[i].Right(aParameters[i].Length() - 11));
+				}
+			/*  else
+			 {
+			 //User::Leave( KErrNotSupported );            	            
+			 }*/
+			}
+		}
+	else if (aParameters.Count() > 1)//&& aParameters[1].Find( KMemSpyCmdSWMTTypeHeapFilter ) == 0 )
+		{
+		aFilter.Copy(aParameters[1].Right(aParameters[1].Length() - 11));
+		}
+	aCategories = result;
+	}
 
-void CMemSpyCommandLine::ParseSWMTParametersL( const CDesCArray& aParameters, TInt& aCategories, TDes& aFilter )
-    {
-    TInt result(0);
-    // Check if the first parameter is a number.
-    // In that case other parameters are ignored.
-    TLex lex( aParameters[ 0 ] );
-    if ( lex.Val( result ) != KErrNone )
-        {		
-        // Parameters were given in text form:
-        const TInt count( aParameters.Count() );
-        for ( TInt i = 0; i < count ; i++ )
-            {
-			lex = aParameters[ i ]; //check if num.
-            if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeHeap ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap |
-                          TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeChunk ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks |
-                          TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeCode ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeStack ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeGlobalData ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeRamDrive ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeOpenFile ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeDiskSpace ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeFbserv ) == 0 ) // enables both FABS and BITM 
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeHandleGeneric ) == 0 ) // enables both HGEN and HPAS
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeFileServerCache ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeSystemMemory ) == 0 )
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeWindowGroup ) == 0 )            	
-                result |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups;            
-            else if ( aParameters[i].CompareF( KMemSpyCmdSWMTTypeAll) == 0 ) //"all" category added
-            	result = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
-            else if ( aParameters[i].CompareF( KMemSpyCmdSwmtParameterDumpnow) == 0 || 
-            		aParameters[i].CompareF( KMemSpyCmdSwmtParameterStarttimer) == 0 || 
-            		aParameters[i].CompareF( KMemSpyCmdSwmtParameterStoptimer) == 0 )
-            	{    
-				TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine:: command parameter") );
-            	}
-            else if ( lex.Val( result ) == KErrNone )
-            	{
-				TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine:: number - timer period") );
-            	}
-            else// if ( aParameters[i].Find( KMemSpyCmdSWMTTypeHeapFilter ) == 0 )
-                {				
-                aFilter.Copy( aParameters[i].Right( aParameters[i].Length() -11 ) );              
-                }
-          /*  else
-            	{
-                //User::Leave( KErrNotSupported );            	            
-            	}*/
-            }
-        }
-    else if ( aParameters.Count() > 1 )//&& aParameters[1].Find( KMemSpyCmdSWMTTypeHeapFilter ) == 0 )
-        {
-        aFilter.Copy( aParameters[1].Right( aParameters[1].Length() -11 ) );
-        }
-    aCategories = result;
-    }
+TInt CMemSpyCommandLine::FindBatchFile(TDes &aFileName)
+	{
+	if ( BaflUtils::FileExists( iFsSession, aFileName )) return KErrNone;
+	if ( !FindFile( aFileName, _L("\\") ) ) return KErrNone;
+	if ( !FindFile( aFileName, _L("\\data\\") ) ) return KErrNone;
+	if (!FindFile(aFileName, _L("\\documents\\"))) return KErrNone;
+	if (!FindFile(aFileName, _L("\\temp\\"))) return KErrNone;
+	if (!FindFile(aFileName, _L("\\system\\temp\\"))) return KErrNone;
+	// if ( !FindFile( aFileName, _L("\\private\\1000484b\\") ) ) return KErrNone; // Mail folder KErrPermissionDenied  
+	return KErrNotFound;
+	}
 
-
-TInt CMemSpyCommandLine::FindBatchFile( TDes &aFileName )
-    {
-    if ( BaflUtils::FileExists( iFsSession, aFileName )) return KErrNone;
-    if ( !FindFile( aFileName, _L("\\") ) ) return KErrNone;
-    if ( !FindFile( aFileName, _L("\\data\\") ) ) return KErrNone;
-    if ( !FindFile( aFileName, _L("\\documents\\") ) ) return KErrNone;
-    if ( !FindFile( aFileName, _L("\\temp\\") ) ) return KErrNone;
-    if ( !FindFile( aFileName, _L("\\system\\temp\\") ) ) return KErrNone;
-    // if ( !FindFile( aFileName, _L("\\private\\1000484b\\") ) ) return KErrNone; // Mail folder KErrPermissionDenied  
-    return KErrNotFound;
-    }
-
-
-TInt CMemSpyCommandLine::FindFile( TDes &aFileName, const TDesC &aDirPath )
-    {
-    TFindFile fileFinder( iFsSession );
-    TInt err = fileFinder.FindByDir( aFileName, aDirPath );
-    if ( !err )
-        {
-        aFileName.Copy( fileFinder.File() );
-        }
-    return err;
-    }
-
+TInt CMemSpyCommandLine::FindFile(TDes &aFileName, const TDesC &aDirPath)
+	{
+	TFindFile fileFinder(iFsSession);
+	TInt err = fileFinder.FindByDir(aFileName, aDirPath);
+	if (!err)
+		{
+		aFileName.Copy(fileFinder.File());
+		}
+	return err;
+	}
 
 //CLI status messages methods
 void CMemSpyCommandLine::RedrawInputPrompt()
-    {
-    iConsole.SetCursorPosAbs( iCommandPromptPos );
-    iConsole.ClearToEndOfLine();
-    iConsole.Printf( KMemSpyCLIInputPrompt, &iCommandBuffer );
-    }
-
+	{
+	iConsole.SetCursorPosAbs(iCommandPromptPos);
+	iConsole.ClearToEndOfLine();
+	iConsole.Printf(KMemSpyCLIInputPrompt, &iCommandBuffer);
+	}
 
 void CMemSpyCommandLine::RedrawStatusMessage()
-    {
-    RedrawStatusMessage( KNullDesC );
-    }
-
+	{
+	RedrawStatusMessage(KNullDesC);
+	}
 
-void CMemSpyCommandLine::RedrawStatusMessage( const TDesC& aMessage )
-    {
-    iConsole.SetCursorPosAbs( iStatusMessagePos );
-    iConsole.ClearToEndOfLine();
-    iConsole.Write( aMessage );
-    iConsole.Write( KMemSpyCLINewLine );
-    }
+void CMemSpyCommandLine::RedrawStatusMessage(const TDesC& aMessage)
+	{
+	iConsole.SetCursorPosAbs(iStatusMessagePos);
+	iConsole.ClearToEndOfLine();
+	iConsole.Write(aMessage);
+	iConsole.Write(KMemSpyCLINewLine);
+	}
 
 void CMemSpyCommandLine::WaitForInput()
-    {
-    ASSERT( !IsActive() );
-    iConsole.Read( iStatus );
-    SetActive();
-    }
+	{
+	ASSERT( !IsActive() );
+	iConsole.Read(iStatus);
+	SetActive();
+	}
 
 void CMemSpyCommandLine::DoCancel()
-    {
-    iConsole.ReadCancel();
-    }
+	{
+	iConsole.ReadCancel();
+	}
 
 void CMemSpyCommandLine::RunL()
-    {
-    TKeyCode key = iConsole.KeyCode();
-    //
-    if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
-        {
-        TRAP_IGNORE( ProcessCommandBufferL() );
-        }
-    else
-        {
-        TChar character( key );
-        if  ( character.IsPrint() )
-            {
-            if  ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() )
-                {
-                iCommandBuffer.Append( TChar( key ) );
-                }
+	{
+	TKeyCode key = iConsole.KeyCode();
+	//
+	if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
+		{
+		TRAP_IGNORE( ProcessCommandBufferL() );
+		}
+	else
+		{
+		TChar character(key);
+		if (character.IsPrint())
+			{
+			if (iCommandBuffer.Length() < iCommandBuffer.MaxLength())
+				{
+				iCommandBuffer.Append(TChar(key));
+				}
 
-            RedrawInputPrompt();
-            }
-        }
+			RedrawInputPrompt();
+			}
+		}
 
-    WaitForInput();
-    }
+	WaitForInput();
+	}
 
-TInt CMemSpyCommandLine::RunError( TInt aError )
-	{	
+TInt CMemSpyCommandLine::RunError(TInt aError)
+	{
 	return KErrNone;
 	}
 
 void CMemSpyCommandLine::ProcessCommandBufferL()
-    {
-    iCommandBuffer.Trim();
-    //
+	{
+	iCommandBuffer.Trim();
+	//
 #ifdef _DEBUG
-    RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer );
+	RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer );
 #endif
-    //
-    TBool validCommand = EFalse;
-    if  ( iCommandBuffer.Length() == 1 )
-        {
-        // Reset if not recognised...
-        validCommand = ETrue;
+	//
+	TBool validCommand = EFalse;
+	if (iCommandBuffer.Length() == 1)
+		{
+		// Reset if not recognised...
+		validCommand = ETrue;
 
-        const TChar cmd = iCommandBuffer[ 0 ]; 
-        switch( cmd )
-            {
-        	case 's':
-        	case 'S':
-        		{
-        		iMemSpy->PerformOperation( EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop );
-        		
-        		CActiveScheduler::Stop();
-        		return;
-        		}
-        	case 'c':
-        	case 'C':
-        		CActiveScheduler::Stop();
-        		return;            
-        	default:
-        		validCommand = EFalse;
-        		break;
-            }
-        }    
-    if  ( !validCommand )
-        {
-        _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
-        RedrawStatusMessage( KInvalidEntry );
-        RedrawInputPrompt();
-        }
-    }
+		const TChar cmd = iCommandBuffer[0];
+		switch (cmd)
+			{
+			case 's':
+			case 'S':
+				{
+				iMemSpy->PerformOperation( EMemSpyClientServerOpSystemWideMemoryTrackingTimerStop );
+
+				CActiveScheduler::Stop();
+				return;
+				}
+			case 'c':
+			case 'C':
+				CActiveScheduler::Stop();
+				return;
+			default:
+				validCommand = EFalse;
+				break;
+			}
+		}
+	if (!validCommand)
+		{
+		_LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
+		RedrawStatusMessage(KInvalidEntry);
+		RedrawInputPrompt();
+		}
+	}
--- a/perfsrv/memspy/CommandLine/group/MemSpyCommandLine.mmp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/CommandLine/group/MemSpyCommandLine.mmp	Mon Oct 04 02:45:59 2010 +0300
@@ -37,8 +37,6 @@
 
 OS_LAYER_SYSTEMINCLUDE
 
-APP_LAYER_SYSTEMINCLUDE
-
 LIBRARY         MemSpyClient.lib
 
 LIBRARY					euser.lib 
--- a/perfsrv/memspy/Driver/BWINS/memspydriverclientu.def	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/BWINS/memspydriverclientu.def	Mon Oct 04 02:45:59 2010 +0300
@@ -17,7 +17,7 @@
 	?GetContainerHandles@RMemSpyDriverClient@@QAEHW4TMemSpyDriverContainerType@@PAPAXAAH@Z @ 16 NONAME ; int RMemSpyDriverClient::GetContainerHandles(enum TMemSpyDriverContainerType, void * *, int &)
 	?GetGenericHandleInfo@RMemSpyDriverClient@@QAEHHW4TMemSpyDriverContainerType@@PAXAAVTMemSpyDriverHandleInfoGeneric@@@Z @ 17 NONAME ; int RMemSpyDriverClient::GetGenericHandleInfo(int, enum TMemSpyDriverContainerType, void *, class TMemSpyDriverHandleInfoGeneric &)
 	?GetHeapData@RMemSpyDriverClient@@QAEHIKAAVTDes8@@AAI1@Z @ 18 NONAME ; int RMemSpyDriverClient::GetHeapData(unsigned int, unsigned long, class TDes8 &, unsigned int &, unsigned int &)
-	?GetHeapDataKernelLC@RMemSpyDriverClient@@QAEPAVHBufC8@@AAVTMemSpyHeapInfo@@AAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 19 NONAME ; class HBufC8 * RMemSpyDriverClient::GetHeapDataKernelLC(class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> &)
+	?GetHeapDataKernelLC@RMemSpyDriverClient@@QAEPAVHBufC8@@AAVTMemSpyHeapInfo@@AAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 19 NONAME ABSENT
 	?GetHeapDataNext@RMemSpyDriverClient@@QAEHIAAVTDes8@@AAI1@Z @ 20 NONAME ; int RMemSpyDriverClient::GetHeapDataNext(unsigned int, class TDes8 &, unsigned int &, unsigned int &)
 	?GetHeapInfoKernel@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@@Z @ 21 NONAME ; int RMemSpyDriverClient::GetHeapInfoKernel(class TMemSpyHeapInfo &)
 	?GetHeapInfoKernel@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@AAV?$RArray@VTMemSpyDriverFreeCell@@@@@Z @ 22 NONAME ; int RMemSpyDriverClient::GetHeapInfoKernel(class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> &)
@@ -68,4 +68,10 @@
 	?GetCondVarSuspendedThreads@RMemSpyDriverClient@@QAEHPAXPAPAXAAH@Z @ 67 NONAME ; int RMemSpyDriverClient::GetCondVarSuspendedThreads(void *, void * *, int &)
 	?GetCondVarSuspendedThreadInfo@RMemSpyDriverClient@@QAEHPAXAAVTMemSpyDriverCondVarSuspendedThreadInfo@@@Z @ 68 NONAME ; int RMemSpyDriverClient::GetCondVarSuspendedThreadInfo(void *, class TMemSpyDriverCondVarSuspendedThreadInfo &)
 	?GetHeapInfoUser@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@IAAV?$RArray@VTMemSpyDriverFreeCell@@@@H@Z @ 69 NONAME ; int RMemSpyDriverClient::GetHeapInfoUser(class TMemSpyHeapInfo &, unsigned int, class RArray<class TMemSpyDriverFreeCell> &, int)
+	?GetHeapDataKernelNext@RMemSpyDriverClient@@QAEHIAAVTDes8@@AAI1@Z @ 70 NONAME ; int RMemSpyDriverClient::GetHeapDataKernelNext(unsigned int, class TDes8 &, unsigned int &, unsigned int &)
+	?CopyHeapDataKernel@RMemSpyDriverClient@@QAEHXZ @ 71 NONAME ; int RMemSpyDriverClient::CopyHeapDataKernel(void)
+	?FreeHeapDataKernel@RMemSpyDriverClient@@QAEHXZ @ 72 NONAME ; int RMemSpyDriverClient::FreeHeapDataKernel(void)
+	?GetHeapInfoKernel@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@AAV?$RArray@VTMemSpyDriverFreeCell@@@@HH@Z @ 73 NONAME ; int RMemSpyDriverClient::GetHeapInfoKernel(class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> &, int, int)
+	?GetHeapInfoKernel@RMemSpyDriverClient@@QAEHAAVTMemSpyHeapInfo@@AAV?$RArray@VTMemSpyDriverFreeCell@@@@H@Z @ 74 NONAME ; int RMemSpyDriverClient::GetHeapInfoKernel(class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> &, int)
+	?GetHeapDataKernel@RMemSpyDriverClient@@QAEHIAAVTDes8@@AAI1@Z @ 75 NONAME ; int RMemSpyDriverClient::GetHeapDataKernel(unsigned int, class TDes8 &, unsigned int &, unsigned int &)
 
--- a/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h	Mon Oct 04 02:45:59 2010 +0300
@@ -26,6 +26,7 @@
 
 // User includes
 #include "MemSpyDriverObjectsInternal.h"
+#include "MemSpyDriverOSAdaption.h"
 
 // Constants
 // We shouldn't be using any of these any more! -Tomsci
@@ -34,7 +35,6 @@
 const TUint KRHeapMemberDataSize = KRHeapObjectSize - KRAllocatorAndRHeapMemberDataOffset;
 
 // Classes referenced
-class DMemSpyDriverOSAdaption;
 namespace LtkUtils
 	{
 	class RAllocatorHelper;
@@ -58,49 +58,12 @@
 	virtual void Close();
     virtual DChunk& Chunk() = 0;
     virtual const DChunk& Chunk() const = 0;
+    virtual const TLinAddr ChunkBase() const = 0;
 
 protected:
 	LtkUtils::RAllocatorHelper* iHelper;
     };
 
-
-
-
-class RMemSpyDriverRHeapReadFromCopy : public RMemSpyDriverRHeapBase
-	{
-protected:
-    RMemSpyDriverRHeapReadFromCopy( DMemSpyDriverOSAdaption& aOSAdaption );
-
-public: // New API
-    void AssociateWithKernelChunk( DChunk* aChunk, TLinAddr aAddress, TUint32 aMappingAttributes );
-
-public: // From RMemSpyDriverRHeapBase
-    void Reset();
-    DChunk& Chunk();
-    const DChunk& Chunk() const;
-
-protected:
-    inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
-
-private:
-    DMemSpyDriverOSAdaption& iOSAdaption;
-
-    // Copy of the client's heap data
-    DChunk* iChunk;
-    TLinAddr iChunkAddress;
-    TUint32 iChunkMappingAttributes;
-
-    // Calculated delta between client's address space values and actual kernel
-    // address of the heap chunk.
-    //TUint iClientToKernelDelta;
-    };
-
-
-
-
-
-
-
 class RMemSpyDriverRHeapUser : public RMemSpyDriverRHeapBase
 	{
 public:
@@ -109,9 +72,11 @@
 
 	DChunk& Chunk() { return *iChunk; }
 	const DChunk& Chunk() const { return *iChunk; }
+	const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); } 
 
 private:
     inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
+    inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; } 
 
 private:
     DMemSpyDriverOSAdaption& iOSAdaption;
@@ -119,29 +84,39 @@
     };
 
 
-
-class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapReadFromCopy
+class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapBase
     {
 public:
     RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption );
     
 public: // API
-    void SetKernelHeap( RHeapK& aKernelHeap );
+    TInt AssociateWithKernelChunk( DChunk* aKernelChunk, DChunk* aCopiedChunk, TLinAddr aCopiedChunkBase, TInt aOffset );
+    TBool IsOpen();
 
 public: // From RMemSpyDriverRHeapBase
-    //void DisassociateWithKernelChunk();
-	void Close();
+    void Reset();
+    void Close();
+    DChunk& Chunk();
+    const DChunk& Chunk() const;
+    const TLinAddr ChunkBase() const { return iChunkBase; } 
 
 private:
-    RHeapK* iKernelHeap;
+    inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
+    inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; }
+    
+private:
+    DMemSpyDriverOSAdaption& iOSAdaption;
+
+    // Copy of the client's heap data
+    DChunk* iChunk;
+    TLinAddr iChunkBase;
     };
 
 
-
 class RMemSpyDriverRHeapKernelInPlace : public RMemSpyDriverRHeapBase
     {
 public:
-    RMemSpyDriverRHeapKernelInPlace();
+    RMemSpyDriverRHeapKernelInPlace( DMemSpyDriverOSAdaption& aOSAdaption );
 	TInt OpenKernelHeap();
     
 
@@ -150,10 +125,17 @@
 
     DChunk& Chunk();
     const DChunk& Chunk() const;
+    const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); } 
 
-	// Only important member data is the base class's RAllocatorHelper
-	// We do cache the chunk though
+private:
+    inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
+    inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; }
+
 private:
+    DMemSpyDriverOSAdaption& iOSAdaption;
+
+    // Only important member data is the base class's RAllocatorHelper
+    // We do cache the chunk though
 	DChunk* iChunk;
     };
 
--- a/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverOSAdaption.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverOSAdaption.h	Mon Oct 04 02:45:59 2010 +0300
@@ -474,6 +474,23 @@
     inline DMemSpyDriverOSAdaptionDTimer& DTimer() { return *iDTimer; }
     inline DMemSpyDriverOSAdaptionDPropertyRef& DPropertyRef() { return *iDPropertyRef; }
 
+    inline const DMemSpyDriverDevice& Device() const { return iDevice; }
+    inline const DMemSpyDriverOSAdaptionDProcess& DProcess() const { return *iDProcess; }
+    inline const DMemSpyDriverOSAdaptionDThread& DThread() const { return *iDThread; }
+    inline const DMemSpyDriverOSAdaptionDChunk& DChunk() const { return *iDChunk; }
+    inline const DMemSpyDriverOSAdaptionDServer& DServer() const { return *iDServer; }
+    inline const DMemSpyDriverOSAdaptionDSession& DSession() const { return *iDSession; }
+    inline const DMemSpyDriverOSAdaptionDCodeSeg& DCodeSeg() const { return *iDCodeSeg; }
+    inline const DMemSpyDriverOSAdaptionDSemaphore& DSemaphore() const { return *iDSemaphore; }
+    inline const DMemSpyDriverOSAdaptionDMutex& DMutex() const { return *iDMutex; }
+    inline const DMemSpyDriverOSAdaptionDLogicalDevice& DLogicalDevice() const { return *iDLogicalDevice; }
+    inline const DMemSpyDriverOSAdaptionDPhysicalDevice& DPhysicalDevice() const { return *iDPhysicalDevice; }
+    inline const DMemSpyDriverOSAdaptionDChangeNotifier& DChangeNotifier() const { return *iDChangeNotifier; }
+    inline const DMemSpyDriverOSAdaptionDUndertaker& DUndertaker() const { return *iDUndertaker; }
+    inline const DMemSpyDriverOSAdaptionDCondVar& DCondVar() const { return *iDCondVar; }
+    inline const DMemSpyDriverOSAdaptionDTimer& DTimer() const { return *iDTimer; }
+    inline const DMemSpyDriverOSAdaptionDPropertyRef& DPropertyRef() const { return *iDPropertyRef; }    
+    
 private: // Data members
     DMemSpyDriverDevice& iDevice;
     DMemSpyDriverOSAdaptionDThread* iDThread;
--- a/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapBase.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapBase.h	Mon Oct 04 02:45:59 2010 +0300
@@ -19,7 +19,6 @@
 #define MEMSPYDRIVERLOGICALCHANHEAPBASE_H
 
 // System includes
-#include <kern_priv.h>
 #include <memspy/driver/memspydriverobjectsshared.h>
 #include <memspy/driver/memspydriverenumerationsshared.h>
 
@@ -66,9 +65,6 @@
     TBool HandleHeapCell( TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber );
 
 protected: // Heap utility functions
-    TInt OpenKernelHeap( RHeapK*& aHeap, DChunk*& aChunk, TDes8* aClientHeapChunkName = NULL );
-    TInt OpenKernelHeap( RMemSpyDriverRHeapKernelFromCopy& aHeap, TDes8* aClientHeapChunkName = NULL );
-    TInt GetHeapInfoKernel(RMemSpyDriverRHeapBase& aHeap, TMemSpyHeapInfo* aHeapInfo, TDes8* aTransferBuffer);
     void PrintHeapInfo( const TMemSpyHeapInfo& aInfo );
 
 private: // Data members
--- a/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapData.h	Fri Sep 17 08:38:31 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYDRIVERLOGICALCHANHEAPDATA_H
-#define MEMSPYDRIVERLOGICALCHANHEAPDATA_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-#ifdef __MARM__
-#include <arm.h>
-#endif
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverHeap.h"
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverLogChanHeapBase.h"
-#include "MemSpyDriverObjectsInternal.h"
-#include "MemSpyDriverEnumerationsInternal.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-
-
-
-class DMemSpyDriverLogChanHeapData : public DMemSpyDriverLogChanHeapBase
-	{
-public:
-	DMemSpyDriverLogChanHeapData( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanHeapData();
-
-private: // from DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt GetHeapDataUser( TMemSpyDriverInternalHeapDataParams* aParams );
-        
-private: // Internal methods
-    TInt GetHeapDataUser( TMemSpyDriverInternalHeapDataParams& aParams );
-    TInt GetHeapDataKernelInit( TMemSpyHeapInfo* aInfo, TDes8* aFreeCells );
-    TInt GetHeapDataKernelFetch( TDes8* aSink );
-
-private:
-    TMemSpyDriverInternalHeapRequestParameters iHeapInfoParams;
-    RMemSpyDriverRHeapKernelFromCopy iKernelHeap;
-	};
-
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapDataBase.h	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYDRIVERLOGICALCHANHEAPDATABASE_H
+#define MEMSPYDRIVERLOGICALCHANHEAPDATABASE_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+#ifdef __MARM__
+#include <arm.h>
+#endif
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverHeap.h"
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverLogChanHeapBase.h"
+#include "MemSpyDriverObjectsInternal.h"
+#include "MemSpyDriverHeapWalker.h"
+#include "MemSpyDriverEnumerationsInternal.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class RMemSpyMemStreamWriter;
+
+const static TInt KPageSize = 4096;
+
+class DMemSpyDriverLogChanHeapDataBase : public DMemSpyDriverLogChanHeapBase
+	{
+public:
+	DMemSpyDriverLogChanHeapDataBase( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanHeapDataBase();
+
+private: // From MHeapWalkerObserver
+    void HandleHeapWalkInit();
+    TBool HandleHeapCell( TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber );   
+    
+protected: // For use by the base classes
+    TInt PrepareCellListTransferBuffer();
+    TInt FetchCellList(TDes8* aBufferSink);
+    void ReleaseCellList();
+    TInt CalculateCellListBufferSize() const;
+    TInt GetFullData( TMemSpyDriverInternalHeapDataParams* aParams );
+    TInt DoGetFullData(TMemSpyDriverInternalHeapDataParams& aParams, DThread* aThread, RMemSpyDriverRHeapBase& aHeap);
+
+protected: // To be implemetned by the base classes
+    virtual TInt GetFullData( TMemSpyDriverInternalHeapDataParams& aParams ) = 0;
+
+protected: // Data members
+    TMemSpyDriverInternalHeapRequestParameters iHeapInfoParams;
+	RArray<TMemSpyDriverCell> iCellList;
+    RMemSpyMemStreamWriter* iHeapStream;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapDataKernel.h	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYDRIVERLOGICALCHANHEAPDATAKERNEL_H
+#define MEMSPYDRIVERLOGICALCHANHEAPDATAKERNEL_H
+
+// User includes
+#include "MemSpyDriverLogChanHeapDataBase.h"
+
+class DMemSpyDriverLogChanHeapDataKernel : public DMemSpyDriverLogChanHeapDataBase
+	{
+public:    
+    DMemSpyDriverLogChanHeapDataKernel( DMemSpyDriverDevice& aDevice, DThread& aThread );
+    
+private: // from DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt GetInfoData( TMemSpyDriverInternalHeapRequestParameters* aParams );
+    TInt GetIsDebugKernel(TAny* aIsDebugKernel);
+    TInt MakeKernelHeapCopy();
+    void FreeKernelHeapCopy();
+
+private: // Internal methods
+    TInt GetInfoData(RMemSpyDriverRHeapBase& aHeap);
+    TInt OpenKernelHeap( RMemSpyDriverRHeapKernelFromCopy& aHeap );   
+    TInt GetHeapDataUser( TMemSpyDriverInternalHeapDataParams& aParams );
+    TInt GetFullData( TMemSpyDriverInternalHeapDataParams& aParams );
+
+private: // Data members	
+	RMemSpyDriverRHeapKernelFromCopy iKernelHeap;
+	};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapDataUser.h	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYDRIVERLOGICALCHANHEAPDATAUSER_H
+#define MEMSPYDRIVERLOGICALCHANHEAPDATAUSER_H
+
+// User includes
+#include "MemSpyDriverLogChanHeapDataBase.h"
+
+class DMemSpyDriverLogChanHeapDataUser : public DMemSpyDriverLogChanHeapDataBase
+	{
+public:
+	DMemSpyDriverLogChanHeapDataUser( DMemSpyDriverDevice& aDevice, DThread& aThread );
+
+private: // from DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt GetInfoData( TMemSpyDriverInternalHeapRequestParameters* aParams );
+
+private: // Internal methods
+    TInt GetFullData( TMemSpyDriverInternalHeapDataParams& aParams );
+	};
+
+
+#endif
--- a/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapInfo.h	Fri Sep 17 08:38:31 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYDRIVERLOGICALCHANHEAPINFO_H
-#define MEMSPYDRIVERLOGICALCHANHEAPINFO_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-#ifdef __MARM__
-#include <arm.h>
-#endif
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverLogChanHeapBase.h"
-#include "MemSpyDriverObjectsInternal.h"
-#include "MemSpyDriverHeapWalker.h"
-#include "MemSpyDriverEnumerationsInternal.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class RMemSpyDriverRHeapKernel;
-class RMemSpyMemStreamWriter;
-
-
-class DMemSpyDriverLogChanHeapInfo : public DMemSpyDriverLogChanHeapBase
-	{
-public:
-	DMemSpyDriverLogChanHeapInfo( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanHeapInfo();
-
-private: // from DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt GetHeapInfoUser( TMemSpyDriverInternalHeapRequestParameters* aParams );
-    TInt GetHeapInfoKernel( TMemSpyDriverInternalHeapRequestParameters* aParams, TDes8* aTransferBuffer );
-    TInt GetIsDebugKernel(TAny* aIsDebugKernel);
-
-private: // From MHeapWalkerObserver
-    void HandleHeapWalkInit();
-    TBool HandleHeapCell( TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber );
-
-private: // Internal methods
-	void ReleaseCellList();
-    TInt PrepareCellListTransferBuffer();
-	TInt FetchCellList(TDes8* aBufferSink);
-    TInt CalculateCellListBufferSize() const;
-
-private: // Data members
-    TMemSpyDriverInternalHeapRequestParameters iHeapInfoParams;
-	RArray<TMemSpyDriverCell> iCellList;
-    RMemSpyMemStreamWriter* iHeapStream;
-	};
-
-
-#endif
--- a/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalk.h	Fri Sep 17 08:38:31 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef MEMSPYDRIVERLOGICALCHANHEAPWALK_H
-#define MEMSPYDRIVERLOGICALCHANHEAPWALK_H
-
-// System includes
-#include <e32cmn.h>
-#include <kern_priv.h>
-#ifdef __MARM__
-#include <arm.h>
-#endif
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverenumerationsshared.h>
-
-// User includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverHeapWalker.h"
-#include "MemSpyDriverObjectsInternal.h"
-#include "MemSpyDriverLogChanHeapBase.h"
-#include "MemSpyDriverEnumerationsInternal.h"
-
-// Classes referenced
-class DMemSpyDriverDevice;
-class TMemSpyDriverLogChanHeapWalkObserver;
-
-
-class DMemSpyDriverLogChanHeapWalk : public DMemSpyDriverLogChanHeapBase
-	{
-public:
-	DMemSpyDriverLogChanHeapWalk( DMemSpyDriverDevice& aDevice, DThread& aThread );
-	~DMemSpyDriverLogChanHeapWalk();
-
-private: // from DMemSpyDriverLogChanBase
-	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
-    TBool IsHandler( TInt aFunction ) const;
-
-private: // Channel operation handlers
-    TInt WalkHeapInit( TMemSpyDriverInternalWalkHeapParamsInit* aParams );
-    TInt WalkHeapNextCell( TUint aTid, TMemSpyDriverInternalWalkHeapParamsCell* aParams );
-    TInt WalkHeapClose();
-    TInt WalkHeapReadCellData( TMemSpyDriverInternalWalkHeapCellDataReadParams* aParams);
-    TInt WalkHeapGetCellInfo( TAny* aCellAddress, TMemSpyDriverInternalWalkHeapParamsCell* aParams );
-        
-private: // Internal methods
-    const TMemSpyDriverInternalWalkHeapParamsCell* CellInfoForAddressWithinCellRange( TAny* aAddress ) const;
-    const TMemSpyDriverInternalWalkHeapParamsCell* CellInfoForSpecificAddress( TAny* aAddress ) const;
-
-private: // Heap walker callback
-    TBool WalkerHandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber );
-
-private:
-    TBool iHeapWalkInitialised;
-    TInt iWalkHeapCellIndex;
-    RMemSpyDriverRHeapUser iWalkHeap;
-	RArray< TMemSpyDriverInternalWalkHeapParamsCell > iWalkHeapCells;
-    TMemSpyDriverInternalWalkHeapParamsInit iHeapWalkInitialParameters;
-
-private:
-    friend class TMemSpyDriverLogChanHeapWalkObserver;
-	};
-
-
-class TMemSpyDriverLogChanHeapWalkObserver : public MMemSpyHeapWalkerObserver
-    {
-public:
-    inline TMemSpyDriverLogChanHeapWalkObserver( DMemSpyDriverLogChanHeapWalk& aChannel )
-        : iChannel( aChannel )
-        {
-        }
-
-public: // From MHeapWalkerObserver
-    void HandleHeapWalkInit() { }
-    TBool HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
-        {
-        return iChannel.WalkerHandleHeapCell( aCellType, aCellAddress, aLength, aNestingLevel, aAllocNumber );
-        }
-
-private:
-    DMemSpyDriverLogChanHeapWalk& iChannel;
-    };
-
-
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Include/SubChannels/MemSpyDriverLogChanHeapWalkUser.h	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef MEMSPYDRIVERLOGICALCHANHEAPWALKUSER_H
+#define MEMSPYDRIVERLOGICALCHANHEAPWALKUSER_H
+
+// System includes
+#include <e32cmn.h>
+#include <kern_priv.h>
+#ifdef __MARM__
+#include <arm.h>
+#endif
+#include <memspy/driver/memspydriverobjectsshared.h>
+#include <memspy/driver/memspydriverenumerationsshared.h>
+
+// User includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverHeapWalker.h"
+#include "MemSpyDriverObjectsInternal.h"
+#include "MemSpyDriverLogChanHeapBase.h"
+#include "MemSpyDriverEnumerationsInternal.h"
+
+// Classes referenced
+class DMemSpyDriverDevice;
+class TMemSpyDriverLogChanHeapWalkObserver;
+
+
+class DMemSpyDriverLogChanHeapWalkUser : public DMemSpyDriverLogChanHeapBase
+	{
+public:
+	DMemSpyDriverLogChanHeapWalkUser( DMemSpyDriverDevice& aDevice, DThread& aThread );
+	~DMemSpyDriverLogChanHeapWalkUser();
+
+private: // from DMemSpyDriverLogChanBase
+	TInt Request( TInt aFunction, TAny* a1, TAny* a2 );
+    TBool IsHandler( TInt aFunction ) const;
+
+private: // Channel operation handlers
+    TInt WalkHeapInit( TMemSpyDriverInternalWalkHeapParamsInit* aParams );
+    TInt WalkHeapNextCell( TUint aTid, TMemSpyDriverInternalWalkHeapParamsCell* aParams );
+    TInt WalkHeapClose();
+    TInt WalkHeapReadCellData( TMemSpyDriverInternalWalkHeapCellDataReadParams* aParams);
+    TInt WalkHeapGetCellInfo( TAny* aCellAddress, TMemSpyDriverInternalWalkHeapParamsCell* aParams );
+        
+private: // Internal methods
+    const TMemSpyDriverInternalWalkHeapParamsCell* CellInfoForAddressWithinCellRange( TAny* aAddress ) const;
+    const TMemSpyDriverInternalWalkHeapParamsCell* CellInfoForSpecificAddress( TAny* aAddress ) const;
+
+private: // Heap walker callback
+    TBool WalkerHandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber );
+
+private:
+    TBool iHeapWalkInitialised;
+    TInt iWalkHeapCellIndex;
+    RMemSpyDriverRHeapUser iWalkHeap;
+	RArray< TMemSpyDriverInternalWalkHeapParamsCell > iWalkHeapCells;
+    TMemSpyDriverInternalWalkHeapParamsInit iHeapWalkInitialParameters;
+
+private:
+    friend class TMemSpyDriverLogChanHeapWalkObserver;
+	};
+
+
+class TMemSpyDriverLogChanHeapWalkObserver : public MMemSpyHeapWalkerObserver
+    {
+public:
+    inline TMemSpyDriverLogChanHeapWalkObserver( DMemSpyDriverLogChanHeapWalkUser& aChannel )
+        : iChannel( aChannel )
+        {
+        }
+
+public: // From MHeapWalkerObserver
+    void HandleHeapWalkInit() { }
+    TBool HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
+        {
+        return iChannel.WalkerHandleHeapCell( aCellType, aCellAddress, aLength, aNestingLevel, aAllocNumber );
+        }
+
+private:
+    DMemSpyDriverLogChanHeapWalkUser& iChannel;
+    };
+
+
+
+#endif
--- a/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverHeap.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverHeap.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -109,167 +109,114 @@
 	*/
     }
 
-RMemSpyDriverRHeapReadFromCopy::RMemSpyDriverRHeapReadFromCopy( DMemSpyDriverOSAdaption& aOSAdaption )
-:   iOSAdaption( aOSAdaption ), iChunk( NULL ), iChunkAddress( 0 ), iChunkMappingAttributes( 0 ) /*, iClientToKernelDelta( 0 )*/
+
+
+
+RMemSpyDriverRHeapUser::RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption )
+    : RMemSpyDriverRHeapBase(), iOSAdaption(aOSAdaption)
     {
     }
 
 
-void RMemSpyDriverRHeapReadFromCopy::Reset()
+TInt RMemSpyDriverRHeapUser::OpenUserHeap(DThread& aThread, TBool aEuserUdeb)
+    {
+    TLinAddr allocatorAddr = (TLinAddr)OSAdaption().DThread().GetAllocator(aThread);
+    NKern::ThreadEnterCS();
+    LtkUtils::RUserAllocatorHelper* helper = new LtkUtils::RUserAllocatorHelper;
+    if (!helper)
+        {
+        NKern::ThreadLeaveCS();
+        return KErrNoMemory;
+        }
+    TInt err = helper->OpenUserHeap(OSAdaption().DThread().GetId(aThread), allocatorAddr, aEuserUdeb);
+    if (!err)
+        {
+        iChunk = helper->OpenUnderlyingChunk();
+        if (!iChunk) err = KErrNotFound;
+        }
+    if (err)
+        {
+        delete helper;
+        }
+    else
+        {
+        iHelper = helper;
+        }
+    NKern::ThreadLeaveCS();
+    return err;
+    }
+
+
+RMemSpyDriverRHeapKernelFromCopy::RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption )
+:   iOSAdaption( aOSAdaption ), iChunk( NULL )
+    {
+    }
+
+
+void RMemSpyDriverRHeapKernelFromCopy::Reset()
     {
     RMemSpyDriverRHeapBase::Reset();
 	//
     iChunk = NULL;
-    iChunkAddress = 0;
-    iChunkMappingAttributes = 0;
-    //iClientToKernelDelta = 0;
-    }
-
-
-void RMemSpyDriverRHeapReadFromCopy::AssociateWithKernelChunk( DChunk* aChunk, TLinAddr aAddress, TUint32 aMappingAttributes )
-    {
-    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::AssociateWithKernelChunk() - START - aChunk: %O, aChunk base: 0x%08x, aAddress: 0x%08x, clients heap base: 0x%08x, aChunk size: %8d", aChunk, aChunk->iBase, aAddress, Base(), aChunk->iSize ) );
-
-    iChunk = aChunk;
-    iChunkAddress = aAddress;
-    iChunkMappingAttributes = aMappingAttributes;
-
-    // Calculate start of real heap data (skipping over embedded RHeap object)
-    // Since we must operate with kernel-side addressing into our cloned heap chunk,
-    // we must use aAddress (the kernel address of the chunk) rather than aChunk->iBase
-    //TOMSCI iClientToKernelDelta = ( (TUint8*) aAddress ) - ( Base() - KRHeapObjectSize );
-
-    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::AssociateWithKernelChunk() - END - delta between client's user-side base address (base: 0x%08x), kernel-side base address (base: 0x%08x), and kernel-side chunk (base: 0x%08x) is: 0x%08x", Base(), aChunk->iBase, aAddress, iClientToKernelDelta) );
     }
 
 
-/*void RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk()
+TInt RMemSpyDriverRHeapKernelFromCopy::AssociateWithKernelChunk( DChunk* aKernelChunk, DChunk* aCopiedChunk, TLinAddr aCopiedChunkBase, TInt aOffset )
     {
-    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk() - START - iChunk: 0x%08x", iChunk ) );
+    TRACE_KH( Kern::Printf("RMemSpyDriverRHeapKernelFromCopy::AssociateWithKernelChunk() - START - aChunk: 0x%08x, aOffset: %d", 
+                            aCopiedChunk, aOffset) );
+
+    iChunk = aCopiedChunk;
+    iChunkBase = aCopiedChunkBase;
 
     NKern::ThreadEnterCS();
-    if  ( iChunk != NULL )
+    TInt ret = KErrNone;
+    LtkUtils::RKernelCopyAllocatorHelper* helper = new LtkUtils::RKernelCopyAllocatorHelper();
+    if (helper)
         {
-        Kern::ChunkClose( iChunk );
-        iChunk = NULL;
+        helper->OpenCopiedHeap(aKernelChunk, aCopiedChunk, aOffset);
+        iHelper = helper;        
+        }
+    else
+        {
+        ret = KErrNoMemory;
         }
     NKern::ThreadLeaveCS();
-
-    TRACE_HEAP( Kern::Printf("RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk() - END") );
-    }
-*/
-
-DChunk& RMemSpyDriverRHeapReadFromCopy::Chunk()
-    {
-    return *iChunk;
+    
+    TRACE_KH( Kern::Printf("RMemSpyDriverRHeapKernelFromCopy::AssociateWithKernelChunk() - END") );
+    return ret;
     }
 
-
-const DChunk& RMemSpyDriverRHeapReadFromCopy::Chunk() const
+DChunk& RMemSpyDriverRHeapKernelFromCopy::Chunk()
     {
     return *iChunk;
     }
 
 
-/*TLinAddr RMemSpyDriverRHeapReadFromCopy::ChunkKernelAddress() const
-    {
-    return iChunkAddress;
-    }
-
-
-TBool RMemSpyDriverRHeapReadFromCopy::ChunkIsInitialised() const
+const DChunk& RMemSpyDriverRHeapKernelFromCopy::Chunk() const
     {
-    return iChunk != NULL;
-    }
-
-TUint RMemSpyDriverRHeapReadFromCopy::ClientToKernelDelta() const
-    {
-    return iClientToKernelDelta;
-    }
-*/
-
-
-
-
-
-RMemSpyDriverRHeapUser::RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption )
-	: RMemSpyDriverRHeapBase(), iOSAdaption(aOSAdaption)
-    {
+    return *iChunk;
     }
 
-
-TInt RMemSpyDriverRHeapUser::OpenUserHeap(DThread& aThread, TBool aEuserUdeb)
-	{
-	TLinAddr allocatorAddr = (TLinAddr)OSAdaption().DThread().GetAllocator(aThread);
-	NKern::ThreadEnterCS();
-	LtkUtils::RKernelSideAllocatorHelper* helper = new LtkUtils::RKernelSideAllocatorHelper;
-	if (!helper)
-		{
-		NKern::ThreadLeaveCS();
-		return KErrNoMemory;
-		}
-	TInt err = helper->OpenUserHeap(OSAdaption().DThread().GetId(aThread), allocatorAddr, aEuserUdeb);
-	if (!err)
-		{
-		iChunk = helper->OpenUnderlyingChunk();
-		if (!iChunk) err = KErrNotFound;
-		}
-	if (err)
-		{
-		delete helper;
-		}
-	else
-		{
-		iHelper = helper;
-		}
-	NKern::ThreadLeaveCS();
-	return err;
-	}
-
-RMemSpyDriverRHeapKernelFromCopy::RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption )
-:   RMemSpyDriverRHeapReadFromCopy( aOSAdaption )
-    {
-    }
-
-
-void RMemSpyDriverRHeapKernelFromCopy::SetKernelHeap( RHeapK& aKernelHeap )
-    {
-    TRACE_KH( Kern::Printf("RMemSpyDriverRHeapKernelFromCopy::SetKernelHeap() - START" ) );
-
-    // Perform a copy operation in order to populate base class with a duplicate of the kernel's heap info.
-    iKernelHeap = &aKernelHeap;
-
-    // Source address
-    TUint8* sourceAddress = (TUint8*) iKernelHeap + KRAllocatorAndRHeapMemberDataOffset;
-    TUint8* destinationAddress = (TUint8*) this + KRAllocatorAndRHeapMemberDataOffset;
-
-    // Copy 
-    memcpy( destinationAddress, sourceAddress, KRHeapMemberDataSize );
-
-    // And print info in debug builds for verification...
-    PrintInfo();
-
-    TRACE_KH( Kern::Printf("RMemSpyDriverRHeapKernelFromCopy::SetKernelHeap() - END" ) );
-    }
-
-
-/*
-void RMemSpyDriverRHeapKernelFromCopy::DisassociateWithKernelChunk()
-    {
-    TRACE_KH( Kern::Printf("RMemSpyDriverRHeapKernelFromCopy::DisassociateWithKernelChunk() - START - iKernelHeap: 0x%08x", iKernelHeap ));
-    iKernelHeap = NULL;
-    RMemSpyDriverRHeapReadFromCopy::DisassociateWithKernelChunk();
-    TRACE_KH( Kern::Printf("RMemSpyDriverRHeapKernelFromCopy::DisassociateWithKernelChunk() - END") );
-    }
-*/
-
 void RMemSpyDriverRHeapKernelFromCopy::Close()
 	{
-	//TOMSCI TODO close the chunk
+    if  ( iChunk != NULL )
+        {
+        NKern::ThreadEnterCS();
+        Kern::ChunkClose( iChunk );
+        iChunk = NULL;
+        NKern::ThreadLeaveCS();
+        }
+    RMemSpyDriverRHeapBase::Close();
 	}
 
-RMemSpyDriverRHeapKernelInPlace::RMemSpyDriverRHeapKernelInPlace()
-	: iChunk(NULL)
+TBool RMemSpyDriverRHeapKernelFromCopy::IsOpen()
+    {
+    return (iChunk != NULL);
+    }
+
+RMemSpyDriverRHeapKernelInPlace::RMemSpyDriverRHeapKernelInPlace( DMemSpyDriverOSAdaption& aOSAdaption )
+:   iOSAdaption( aOSAdaption ), iChunk( NULL )
     {
     }
 
--- a/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverLogicalChannel.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Kernel/Source/MemSpyDriverLogicalChannel.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -29,9 +29,9 @@
 #include "MemSpyDriverLogChanClientServer.h"
 #include "MemSpyDriverLogChanCodeSegs.h"
 #include "MemSpyDriverLogChanContainers.h"
-#include "MemSpyDriverLogChanHeapData.h"
-#include "MemSpyDriverLogChanHeapWalk.h"
-#include "MemSpyDriverLogChanHeapInfo.h"
+#include "MemSpyDriverLogChanHeapDataUser.h"
+#include "MemSpyDriverLogChanHeapDataKernel.h"
+#include "MemSpyDriverLogChanHeapWalkUser.h"
 #include "MemSpyDriverLogChanMisc.h"
 #include "MemSpyDriverLogChanProcessInspection.h"
 #include "MemSpyDriverLogChanStack.h"
@@ -179,21 +179,21 @@
         return r;
         }
     //
-    subChan = new DMemSpyDriverLogChanHeapData( device, *iClientThread );
+    subChan = new DMemSpyDriverLogChanHeapDataUser( device, *iClientThread );
     r = SubChannelConstructAndSave( subChan );
     if ( r != KErrNone )
         {
         return r;
         }
     //
-    subChan = new DMemSpyDriverLogChanHeapInfo( device, *iClientThread );
+    subChan = new DMemSpyDriverLogChanHeapDataKernel( device, *iClientThread );
     r = SubChannelConstructAndSave( subChan );
     if ( r != KErrNone )
         {
         return r;
         }
     //
-    subChan = new DMemSpyDriverLogChanHeapWalk( device, *iClientThread );
+    subChan = new DMemSpyDriverLogChanHeapWalkUser( device, *iClientThread );
     r = SubChannelConstructAndSave( subChan );
     if ( r != KErrNone )
         {
--- a/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapBase.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapBase.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -36,8 +36,6 @@
 const TInt KMemSpyDriverLogChanHeapBaseXferBufferSize = 1024 * 16;
 
 
-
-
 DMemSpyDriverLogChanHeapBase::DMemSpyDriverLogChanHeapBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
 :	DMemSpyDriverLogChanBase( aDevice, aThread )
     {
@@ -215,127 +213,7 @@
     TRACE( Kern::Printf("DMemSpyDriverLogChanHeapBase::PrintHeapInfo() - max heap size:                  %d", rHeapMetaData.iMaxHeapSize ) );
     }
 
-TInt DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel(RMemSpyDriverRHeapBase& aHeap, TMemSpyHeapInfo* aHeapInfo, TDes8* aTransferBuffer )
-    {
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel() - START - aTransferBuffer: 0x%08x", aTransferBuffer ) );
-
-    TInt r = KErrNone;
-    NKern::ThreadEnterCS();
-
-    // This object holds all of the info we will accumulate for the client.
-    TMemSpyHeapInfo masterHeapInfo;
-    masterHeapInfo.SetType(aHeap.GetTypeFromHelper());
-    masterHeapInfo.SetTid( 2 );
-    masterHeapInfo.SetPid( 1 );
-
-    // This is the RHeap-specific object that contains all RHeap info
-    TMemSpyHeapInfoRHeap& rHeapInfo = masterHeapInfo.AsRHeap();
-
-
-    // When walking the kernel heap we must keep track of the free cells
-    // without allocating any more memory (on the kernel heap...)
-    //
-    // Therefore, we start a stream immediately, which is actually already
-    // pre-allocated.
-    //
-    // Start stream and pad with zero count, which we'll repopulate later on
-    // once we know the final score.
-    RMemSpyMemStreamWriter stream;
-    TInt32* pCount = NULL;
-
-    // We must walk the client's heap in order to build statistics
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - calling heap walker constructor..."));
-    RMemSpyDriverHeapWalker heapWalker(aHeap);
-    if  ( aTransferBuffer )
-        {
-        // This will allow us to identify that we're writing directly to the stream
-        stream = OpenXferStream();
-        iStackStream = &stream;
-
-        // Writer marker value which we'll update after the traversal completes
-        pCount = stream.WriteInt32( 0 );
-
-        // Receive cell info as we walk the heap...
-        heapWalker.SetObserver( this );
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - collecting free cells - iStackStream: 0x%08x, isOpen: %d, pCount: 0x%08x", iStackStream, stream.IsOpen(), pCount ));
-        }
-    else
-        {
-        iStackStream = NULL;
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - not collecting free cells"));
-        }
-
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - starting traversal..." ));
-
-#if defined( TRACE_TYPE_KERNELHEAP )
-    heapWalker.SetPrintDebug();
-#endif
-    r = heapWalker.Traverse();
-
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - finished traversal - err: %d, iStackStream: 0x%08x, pCount: 0x%08x, isOpen: %d", 
-                            r, iStackStream, pCount, ( iStackStream == NULL ? 0 : iStackStream->IsOpen() ) ));
-
-    // Write free cells if requested
-    if  ( r == KErrNone && iStackStream && iStackStream->IsOpen() && pCount )
-        {
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - final free cell count: %d", iFreeCellCount ));
-        *pCount = iFreeCellCount;
-        r = stream.WriteAndClose( aTransferBuffer );
-        iStackStream = NULL;
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - stream commit result: %d", r ));
-        }
-
-    TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
-    heapWalker.CopyStatsTo( rHeapStats );
-
-    // Get remaining meta data that isn't stored elsewhere
-    TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
-	TFullName chunkName;
-	aHeap.Chunk().FullName(chunkName);
-    rHeapMetaData.SetChunkName(chunkName);
-    rHeapMetaData.SetChunkSize( (TUint) aHeap.Chunk().Size() );
-    rHeapMetaData.SetChunkHandle( &aHeap.Chunk() );
-    rHeapMetaData.SetChunkBaseAddress( OSAdaption().DChunk().GetBase(aHeap.Chunk()) );
-    rHeapMetaData.SetDebugAllocator(aHeap.Helper()->AllocatorIsUdeb());
-    rHeapMetaData.SetUserThread( EFalse );
-    rHeapMetaData.SetSharedHeap( ETrue );
-	rHeapMetaData.iHeapSize = aHeap.Helper()->CommittedSize();
-	rHeapMetaData.iAllocatorAddress = (TAny*)aHeap.Helper()->AllocatorAddress();
-	rHeapMetaData.iMinHeapSize = aHeap.Helper()->MinCommittedSize();
-	rHeapMetaData.iMaxHeapSize = aHeap.Helper()->MaxCommittedSize();
-
-    PrintHeapInfo( masterHeapInfo );
-
-    // Update info ready for writing back to the user-side
-    if  ( r == KErrNone )
-        {
-        // Write results back to user-side
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel - writing to user-side..."));
-        r = Kern::ThreadRawWrite( &ClientThread(), aHeapInfo, &masterHeapInfo, sizeof( TMemSpyHeapInfo ) );
-        }
-
-    NKern::ThreadLeaveCS();
-
-	TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel() - END - ret: %d", r) );
-    return r;
-    }
-
-
-
-
-
-
-
-
-
-
-    
-
-
-
-
-
-
+// TODO remove this? how is it actually being used?
 TBool DMemSpyDriverLogChanHeapBase::HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt /*aNestingLevel*/, TInt /*aAllocNumber*/)
     {
     TInt error = KErrNone;
@@ -370,198 +248,6 @@
 	iFreeCellCount = 0;
 	}
 
-TInt DMemSpyDriverLogChanHeapBase::OpenKernelHeap( RHeapK*& aHeap, DChunk*& aChunk, TDes8* aClientHeapChunkName )
-    {
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap() - START") );
-
-    // This is what we're searching for...
-    RHeapK* kernelHeap = NULL;
-    DChunk* kernelHeapChunk = NULL;
-
-    // Find the SvHeap chunk....
-    _LIT( KKernelServerHeapChunkName, "SvHeap" );
- 	NKern::ThreadEnterCS();
-   
-    DObjectCon* chunkContainer = Kern::Containers()[EChunk];
-    chunkContainer->Wait();
-    NKern::LockSystem();
-    const TInt chunkCount = chunkContainer->Count();
-
-    for(TInt i=0; i<chunkCount; i++)
-        {
-        DChunk* chunk = (DChunk*) (*chunkContainer)[ i ];
-        //
-        if  ( chunk->NameBuf() )
-            {
-            const TInt findResult = chunk->NameBuf()->Find( KKernelServerHeapChunkName );
-    	    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap - checking chunk: %O against %S => %d", chunk, &KKernelServerHeapChunkName, findResult ) );
-            if  ( findResult != KErrNotFound )
-                {
-                // Found it.
-                kernelHeapChunk = chunk;
-                TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - found chunk with base: 0x%08x", chunk->iBase ) );
-                break;
-                }
-            }
-        }
-
-    NKern::UnlockSystem();
-    chunkContainer->Signal();
-
-    TInt r = KErrNotFound;
-    if  ( kernelHeapChunk != NULL )
-        {
-#ifndef __WINS__
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - kernelHeapChunk: 0x%08x", kernelHeapChunk ) );
-
-        const TRomHeader& romHdr = Epoc::RomHeader();
-	    const TRomEntry* primaryEntry = (const TRomEntry*) Kern::SuperPage().iPrimaryEntry;
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - primaryEntry: 0x%08x, primaryEntry->iAddressLin: 0x%08x", primaryEntry, primaryEntry->iAddressLin ) );
-	    const TRomImageHeader* primaryImageHeader = (const TRomImageHeader*) primaryEntry->iAddressLin;
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - primaryEntry: 0x%08x", primaryImageHeader ) );
-
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - TRomImageHeader::iCodeSize:            0x%08x", primaryImageHeader->iCodeSize ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - TRomImageHeader::iTextSize:            0x%08x", primaryImageHeader->iTextSize ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - TRomImageHeader::iDataSize:            0x%08x", primaryImageHeader->iDataSize ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - TRomImageHeader::iBssSize:             0x%08x", primaryImageHeader->iBssSize ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - TRomImageHeader::iHeapSizeMin:         0x%08x", primaryImageHeader->iHeapSizeMin ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - TRomImageHeader::iHeapSizeMax:         0x%08x", primaryImageHeader->iHeapSizeMax ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - TRomImageHeader::iStackSize:           0x%08x", primaryImageHeader->iStackSize ) );
-
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - romHdr.iKernDataAddress: 0x%08x", romHdr.iKernDataAddress ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - Kern::RoundToPageSize( romHdr.iTotalSvDataSize ): 0x%08x", Kern::RoundToPageSize( romHdr.iTotalSvDataSize ) ) );
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - Kern::RoundToPageSize( kernelProcessCreateInfo.iStackSize ): 0x%08x", Kern::RoundToPageSize( primaryImageHeader->iStackSize ) ) );
-
-        TAny* stack = (TAny*)( romHdr.iKernDataAddress + Kern::RoundToPageSize( romHdr.iTotalSvDataSize ));
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - aStack: 0x%08x", stack ) );
-        
-        // NB: This is supposed to be Kern::RoundToPageSize( kernelProcessCreateInfo.iStackSize ) but that
-        // sometimes returns very dodgy values on ARMv5 Multiple Memory Model when using MemSpy's driver
-        // installed via a SIS file. No idea why. Cache problem? 
-        TAny* heap = (TAny*)(TLinAddr( stack ) + Kern::RoundToPageSize( primaryImageHeader->iStackSize ));
-        TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - aHeap: 0x%08x", heap ) );
-
-        kernelHeap = (RHeapK*) heap;
-#else
-        kernelHeap = (RHeapK*) kernelHeapChunk->Base();
-#endif
-        // Finalise construction of heap 
-        if  ( kernelHeap != NULL )
-            {
-            TRACE_KH( Kern::Printf( "DMemSpyDriverLogChanHeapBase::OpenKernelHeap - kernelHeapChunk->Base(): 0x%08x", kernelHeapChunk->Base() ) );
-            aHeap = kernelHeap;
-            aChunk = kernelHeapChunk;
-
-            // Get the chunk name (if the caller asked for it)
-            if  ( aClientHeapChunkName )
-                {
-                kernelHeapChunk->FullName( *aClientHeapChunkName );
-                }
-
-            // Opened okay
-            r = KErrNone;
-            }
-        else
-            {
-            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap - kernel heap was NULL..."));
-            }
-        }
-    else
-        {
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap - couldnt find kernel chunk..."));
-        r = KErrNotFound;
-        }
-
- 	NKern::ThreadLeaveCS();
-
-	TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap() - END - ret: %d", r ) );
-    return r;
-    }
-
-TInt DMemSpyDriverLogChanHeapBase::OpenKernelHeap( RMemSpyDriverRHeapKernelFromCopy& aHeap, TDes8* aClientHeapChunkName )
-    {
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - START") );
-
-    RHeapK* heap = NULL;
-    DChunk* chunk = NULL;
-    TInt r = OpenKernelHeap( heap, chunk, aClientHeapChunkName );
-	
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - open err: %d", r ) );
-    if  ( r == KErrNone )
-        {
-#ifdef __SYMBIAN_KERNEL_HYBRID_HEAP__
-		// RAllocator::Size() not exported on hybrid heap
-		const TInt heapSize = heap->DebugFunction(RAllocator::EGetSize);
-#else
-        const TInt heapSize = heap->Size();
-#endif
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - heapSize: %d, heap: 0x%08x, chunkBase: 0x%08x", heapSize, heap, chunk->Base() ) );
-
-        // Make a new chunk that we can copy the kernel heap into. We cannot lock the system the entire time
-        // we need to do this, therefore there is no guarantee that the chunk will be large enough to hold the
-        // (current) heap data at the time we need to make the copy. We oversize the chunk by 1mb in the "hope"
-        // that it will be enough... :(
-        TChunkCreateInfo info;
-        info.iType         = TChunkCreateInfo::ESharedKernelSingle;
-        info.iMaxSize      = heapSize + ( 1024 * 1024 );
-        info.iOwnsMemory   = ETrue; // Use memory from system's free pool
-        info.iDestroyedDfc = NULL;
-        #ifdef __EPOC32__
-        info.iMapAttr      = (TInt)EMapAttrFullyBlocking; // Full caching
-        #endif
-
-        // Holds a copy of the client's heap chunk
-        DChunk* heapCopyChunk;
-        TLinAddr heapCopyChunkAddress;
-        TUint32 heapCopyChunkMappingAttributes;
-        r = Kern::ChunkCreate( info, heapCopyChunk, heapCopyChunkAddress, heapCopyChunkMappingAttributes );
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - creating chunk returned: %d", r));
-
-        if  ( r == KErrNone )
-            {
-            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - copy chunk base: 0x%08x, heapCopyChunkAddress: 0x%08x", heapCopyChunk->iBase, heapCopyChunkAddress));
-
-            // Commit memory for entire buffer
-            TUint32 physicalAddress = 0;
-            r = Kern::ChunkCommitContiguous( heapCopyChunk, 0, heapSize, physicalAddress );
-            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - commiting chunk returned: %d", r));
-
-            if  ( r != KErrNone)
-                {
-                // On error, throw away the chunk we have created
-                Kern::ChunkClose( heapCopyChunk );
-                heapCopyChunk = NULL;
-                }
-            else
-                {
-                TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - heapCopyChunk->iSize: 0x%08x, heapCopyChunk->iBase: 0x%08x, heapCopyChunkAddress: 0x%08x, physicalAddress: 0x%08x", heapCopyChunk->iSize, heapCopyChunk->iBase, heapCopyChunkAddress, physicalAddress));
-
-                NKern::LockSystem();
-                const TUint32 copyLength = heapSize; // TODO Min( heap->Size(), heapSize );
-
-                TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - trying to copy %d (vs orig estimate of %d) bytes from kernel allocator address: 0x%08x", copyLength, heapSize, heap));
-                memcpy( (TUint8*) heapCopyChunkAddress, heap, copyLength );
-
-                NKern::UnlockSystem();
-
-                TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - copied kernel heap data" ));
-
-                // Transfer ownership of the copy heap chunk to the heap object. This also calculates the delta
-                // beween the heap addresses in the client's address space and the kernel address space.
-                TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - associate chunk and transfer ownership..." ));
-                aHeap.SetKernelHeap( *heap );
-                aHeap.AssociateWithKernelChunk( heapCopyChunk, heapCopyChunkAddress, heapCopyChunkMappingAttributes );
-                }
-            }
-        else
-            {
-	        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - copy chunk create error: %d", r ) );
-            }
-        }
-
-	TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapBase::OpenKernelHeap(CP) - END - ret: %d", r ) );
-    return r;
-    }
 
 
 
--- a/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapData.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,425 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyDriverLogChanHeapData.h"
-
-// System includes
-#include <u32hal.h>
-#include <e32rom.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-#include <memspy/driver/memspydriverconstants.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverHeap.h"
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverHeapWalker.h"
-#include "MemSpyDriverUserEventMonitor.h"
-#include "MemSpyDriverSuspensionManager.h"
-
-
-
-
-DMemSpyDriverLogChanHeapData::DMemSpyDriverLogChanHeapData( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:	DMemSpyDriverLogChanHeapBase( aDevice, aThread ), iKernelHeap( aDevice.OSAdaption() )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::DMemSpyDriverLogChanHeapData() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanHeapData::~DMemSpyDriverLogChanHeapData()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::~DMemSpyDriverLogChanHeapData() - START - this: 0x%08x", this ));
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::~DMemSpyDriverLogChanHeapData() - END - this: 0x%08x", this ));
-	}
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapData::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanHeapBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-        case EMemSpyDriverOpCodeHeapDataGetUser:
-            r = GetHeapDataUser( (TMemSpyDriverInternalHeapDataParams*) a1 );
-            break;
-        case EMemSpyDriverOpCodeHeapDataGetKernelInit:
-            r = GetHeapDataKernelInit( (TMemSpyHeapInfo*) a1, (TDes8*) a2 );
-            break;
-        case EMemSpyDriverOpCodeHeapDataGetKernelFetch:
-            r = GetHeapDataKernelFetch( (TDes8*) a1 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanHeapData::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeHeapDataBase && aFunction < EMemSpyDriverOpCodeHeapDataEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapData::GetHeapDataUser( TMemSpyDriverInternalHeapDataParams* aParams )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser() - START"));
-
-	TMemSpyDriverInternalHeapDataParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalHeapDataParams) );
-    //
-    if  ( r == KErrNone )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - thread id: %d, remaining: %8d, vtable: 0x%08x", params.iTid, params.iRemaining, params.iRHeapVTable));
-
-        // Work out if we need to read the user or kernel heap data. 
-        //
-        // NB: The two 'get heap data' functions return either an error ( < KErrNone ) or then
-        // return the length of the descriptor data that was written to the client's address
-        // space.
-        //
-        r = GetHeapDataUser( params );
-
-        // Write back to user space if everything went okay. Remember that the 
-        // return value above will be the length of data that was written to the
-        // client if there was no error.
-        if  ( r >= KErrNone )
-            {
-            const TInt clientDescriptorLength = r;
-
-            // Make sure we update client's remaining data
-            r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalHeapDataParams) );
-            
-            // ... and if that went okay, then we return the length of the descriptor data
-            // back to the client.
-            if  ( r == KErrNone )
-                {
-                r = clientDescriptorLength;
-                }
-            }
-        }
-    else
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - params read error: %d", r));
-        }
-
-    // Done
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser() - END - ret: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanHeapData::GetHeapDataKernelInit( TMemSpyHeapInfo* aInfo, TDes8* aFreeCells )
-    {
-    // First phase is to 
-    //
-    // a) Open kernel heap
-    // b) Make a copy of the heap data
-    // c) Walk copy in order to extract statistics (meta data, i.e. TMemSpyHeapInfo)
-    //
-    // The driver leaves kernel context with the copy of the kernel heap still associated with MemSpy's process.
-    // The second driver call will copy the chunk data to user side and release the kernel side chunk.
-    //const TBool isInit = iKernelHeap.ChunkIsInitialised();
-    //TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelInit() - START - isInit: %d", isInit ));
-    //__ASSERT_ALWAYS( !isInit, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicKernelHeapDataInitError ) );
-
-    iKernelHeap.Reset();
-    NKern::ThreadEnterCS();
-
-    TFullName heapChunkName;
-    TInt r = OpenKernelHeap( iKernelHeap, &heapChunkName );
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelInit() - open err: %d", r));
-
-    if  ( r == KErrNone )
-        {
-        r = GetHeapInfoKernel( iKernelHeap, aInfo, aFreeCells );
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapDataKernelInit() - base class get heap info: %d", r) );
-
-        // If everything was okay, we can now return back to user-side, indicating the amount of heap data
-        // that they must prepare to read (in the next operation).
-        if  ( r == KErrNone )
-            {
-            // Indicate how big a buffer the user-side must prepare.
-            r = OSAdaption().DChunk().GetSize( iKernelHeap.Chunk() );
-            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapDataKernelInit() - user side buffer needs to be: %d", r) );
-            }
-        else
-            {
-            // Error scenario - must close heap
-            iKernelHeap.Close();
-            }
-        }
-
-    NKern::ThreadLeaveCS();
-
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelInit() - END - ret: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch( TDes8* aSink )
-    {
-	//TOMSCI TODO this function is fundamentally flawed
-	return KErrNotSupported;
-	/*
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch() - START"));
-
-    NKern::ThreadEnterCS();
-
-    // We should already have an initialised copy of the kernel heap
-    const TBool isInit = iKernelHeap.Helper() != NULL;
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch() - isInit: %d", isInit ));
-    __ASSERT_ALWAYS( isInit, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicKernelHeapDataFetchError ) );
-
-    // Get user side (MemSpy) descriptor length info
-    TInt destLen;
-    TInt destMax;
-    TUint8* destPtr = NULL;
-    TInt r = Kern::ThreadGetDesInfo( &ClientThread(), aSink, destLen, destMax, destPtr, ETrue );
-    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", aSink, destPtr, destLen, destMax, r ));
-
-    if  ( r == KErrNone )
-        {
-        // Calculate start of real heap data (skipping over embedded RHeap object)
-        const TUint8* startOfHeapOffset = iKernelHeap.Base();
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - startOfHeapOffset:    0x%08x", startOfHeapOffset));
-        const TUint heapSize = iKernelHeap.Size();
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - heapSize:               %8d", heapSize));
-
-        if ( destMax >= heapSize )
-            {
-            }
-        else
-            {
-            // Not enough space
-            r = KErrOverflow;
-            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - not enough space in client descriptor" ));
-            }
-
-        // The remaining number of bytes should allow us to calculate the position
-        // to read from.
-        const TInt amountToRead = Min( heapSize, destMax );
-        const TAny* readAddress = startOfHeapOffset;
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - amountToRead:         %d", amountToRead));
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - readAddress:          0x%08x", readAddress));
-        const TPtrC8 pKernelHeapData( (const TUint8*) readAddress, amountToRead );
-
-        // Copy kernel heap data to MemSpy
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - about to do write to user-space..."));
-        r = Kern::ThreadDesWrite( &ClientThread(), aSink, pKernelHeapData, 0, KChunkShiftBy0 | KTruncateToMaxLength, &ClientThread() );
-        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch - write result: %d", r));
-        }
-
-    // Free heap resource
-    iKernelHeap.DisassociateWithKernelChunk();
-
-    NKern::ThreadLeaveCS();
-
-	TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataKernelFetch() - END - ret: %d", r));
-    return r;
-	*/
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const TInt KPageSize = 4096;
-
-TInt DMemSpyDriverLogChanHeapData::GetHeapDataUser( TMemSpyDriverInternalHeapDataParams& aParams )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser() - START") );
-
-	TInt r = OpenTempObject( aParams.iTid, EThread );
-	if  ( r != KErrNone )
-		{
-    	Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser() - END - thread not found");
-		return r;
-		}
-    else 
-        {
-        const DMemSpyDriverLogChanHeapBase::TDrmMatchType drmMatchType = IsDrmThread( TempObjectAsThread() );
-
-        if  ( drmMatchType != DMemSpyDriverLogChanHeapBase::EMatchTypeNone )
-            {
-            // Check whether it's a DRM thread...
-            DThread* thread = (DThread*) TempObject();
-    	    Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser() - END - Not allowing dump of DRM heap - matchType: %d, thread: %O", drmMatchType, thread );
-            CloseTempObject();
-		    return KErrAccessDenied;
-            }
-        }
-
-    // Check that the process' thread's are suspended
-    DThread* thread = (DThread*) TempObject();
-    if  ( SuspensionManager().IsSuspended( *thread ) )
-        {
-        // Open the heap
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - thread: %O", thread) );
-        RMemSpyDriverRHeapUser heap( OSAdaption() );
-		r = heap.OpenUserHeap(*thread, aParams.iDebugAllocator);
-		TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - opening heap returned: %d", r) );
-        if  (r == KErrNone)
-            {
-            if  ( aParams.iChecksum != 0 )
-                {
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - checksum validation requested - expecting: 0x%08x", aParams.iChecksum ) );
-                RMemSpyDriverHeapWalker heapWalker(heap);
-                
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - starting traversal..." ));
-#if ( defined( TRACE_TYPE_USERHEAP ) && defined( TRACE_TYPE_HEAPWALK ) )
-                heapWalker.SetPrintDebug();
-#endif
-                r = heapWalker.Traverse();
-                const TUint32 calculatedChecksum = heapWalker.Stats().iFreeCellCRC;
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - finished traversal - err: %d, checksum: 0x%08x", r, calculatedChecksum ));
-
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - comparing CALCULATED: 0x%08x vs EXPECTED: 0x%08x", calculatedChecksum, aParams.iChecksum ));
-                if  ( calculatedChecksum != aParams.iChecksum )
-                    {
-                    Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - comparing CALCULATED: 0x%08x vs EXPECTED: 0x%08x for thread %O", calculatedChecksum, aParams.iChecksum, thread );
-                    r = KErrCorrupt;
-                    }
-                }
-
-            // Get user side (MemSpy) descriptor length info
-            if  ( r == KErrNone )
-                {
-                TInt destLen = 0;
-                TInt destMax = 0;
-                TUint8* destPtr = NULL;
-                r = Kern::ThreadGetDesInfo( &ClientThread(), aParams.iDes, destLen, destMax, destPtr, ETrue );
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", aParams.iDes, destPtr, destLen, destMax, r ));
-				destMax = destMax & ~(KPageSize-1); // Round down dest max to page size
-				if (destMax <= 0 || (aParams.iReadAddress & (KPageSize-1))) r = KErrArgument; // If destMax is less than a page or the read address isn't a multiple of page size then we don't want to know
-
-                if  ( r == KErrNone )
-                    {
-					const TLinAddr chunkBase = (TLinAddr)OSAdaption().DChunk().GetBase(heap.Chunk());
-					const TLinAddr chunkMaxAddr = chunkBase + OSAdaption().DChunk().GetMaxSize(heap.Chunk());
-        	        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - chunkBase:    0x%08x", chunkBase) );
-        
-					TLinAddr readAddress = aParams.iReadAddress;
-                    if (aParams.iRemaining < 0 )
-                        {
-                        // Initial case, start from the bottom
-                        readAddress = chunkBase;
-						aParams.iRemaining = heap.Helper()->CommittedSize();
-                        }
-
-                    // The remaining number of bytes should allow us to calculate the position
-                    // to read from.
-                    TInt amountToRead = Min( aParams.iRemaining, destMax );
-        	        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - amountToRead:           %8d", amountToRead) );
-        
-                    // Do the read from the heap we are spying on into MemSpy's address space
-					// TomS: I didn't know you could do this - you live and learn
-					do
-						{
-						r = Kern::ThreadRawRead( thread, (const void*)readAddress, destPtr, amountToRead );
-        				TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - read result: %d", r) );
-
-						if (r == KErrBadDescriptor)
-							{
-							// This is not necessarily an error - it could be we've hit an unmapped page
-							if (amountToRead > KPageSize)
-								{
-								// retry reading a single page instead
-								amountToRead = KPageSize;
-								}
-							else
-								{
-								// Try the next page
-								readAddress += KPageSize;
-								}
-							}
-						} while (r == KErrBadDescriptor && readAddress < chunkMaxAddr);
-                    //
-                    if  (r == KErrNone)
-                        {
-                        // Client takes care of updating descriptor length.
-                        r = amountToRead;
-                        }
-        
-                    // Update remaining bytes
-                    aParams.iRemaining -= amountToRead;
-                    aParams.iReadAddress = readAddress;
-                    }
-                }
-			}
-        else
-            {
-    	    Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - couldnt open heap for thread %O, err=%d", thread, r);
-            r = KErrNotSupported;
-            }
-		heap.Close();
-        }
-    else
-        {
-        Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser - parent process not suspended => KErrAccessDenied - thread: %O", thread );
-        r = KErrAccessDenied;
-        }
-
-	CloseTempObject();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapData::GetHeapDataUser() - END - ret: %d", r) );
-    return r;
-    }
-
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapDataBase.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,312 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyDriverLogChanHeapDataUser.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.h>
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverLogChanHeapDataBase.h"
+#include "MemSpyDriverHeap.h"
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverHeapWalker.h"
+#include "MemSpyDriverUserEventMonitor.h"
+#include "MemSpyDriverSuspensionManager.h"
+
+DMemSpyDriverLogChanHeapDataBase::DMemSpyDriverLogChanHeapDataBase( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:	DMemSpyDriverLogChanHeapBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DMemSpyDriverLogChanHeapDataBase() - this: 0x%08x", this ));
+    }
+
+DMemSpyDriverLogChanHeapDataBase::~DMemSpyDriverLogChanHeapDataBase()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::~DMemSpyDriverLogChanHeapDataBase() - START - this: 0x%08x", this ));
+	ReleaseCellList();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::~DMemSpyDriverLogChanHeapDataBase() - END - this: 0x%08x", this ));
+	}
+
+TInt DMemSpyDriverLogChanHeapDataBase::PrepareCellListTransferBuffer()
+    {
+    // Transfer free cells immediately from xfer stream
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::PrepareCellListTransferBuffer() - START - iHeapStream: 0x%08x", iHeapStream ));
+    __ASSERT_ALWAYS( !iHeapStream, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapFreeCellStreamNotClosed ) );
+    //
+    TInt r = KErrNoMemory;
+    //
+    NKern::ThreadEnterCS();
+    //
+    iHeapStream = new RMemSpyMemStreamWriter();
+    if  ( iHeapStream )
+        {
+        const TInt requiredMemory = CalculateCellListBufferSize();
+        r = OpenXferStream( *iHeapStream, requiredMemory );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::PrepareCellListTransferBuffer() - requested %d bytes for free cell list, r: %d", requiredMemory, r ));
+
+        if  ( r == KErrNone )
+            {
+            const TInt count = iCellList.Count();
+            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::PrepareCellListTransferBuffer() - cell count: %d", count ));
+            //
+            iHeapStream->WriteInt32( count );
+            for( TInt i=0; i<count; i++ )
+                {
+                const TMemSpyDriverCell& cell = iCellList[ i ];
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::PrepareCellListTransferBuffer() - storing entry: %d", i ));
+                //
+                iHeapStream->WriteInt32( cell.iType );
+                iHeapStream->WriteUint32( reinterpret_cast<TUint32>( cell.iAddress ) );
+                iHeapStream->WriteInt32( cell.iLength );
+                }
+
+            // Finished with the array now
+            iCellList.Reset();
+
+            // We return the amount of client-side memory that needs to be allocated to hold the buffer
+            r = requiredMemory;
+            }
+        }
+    //
+    NKern::ThreadLeaveCS();
+               
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::PrepareCellListTransferBuffer() - END - r: %d", r));
+	return r;
+    }
+
+TInt DMemSpyDriverLogChanHeapDataBase::FetchCellList( TDes8* aBufferSink )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::FetchCellList() - START - iHeapStream: 0x%08x", iHeapStream ));
+    __ASSERT_ALWAYS( iHeapStream, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapFreeCellStreamNotOpen ) );
+
+    TInt r = KErrNone;
+
+    // Write buffer to client
+    NKern::ThreadEnterCS();
+    r = iHeapStream->WriteAndClose( aBufferSink );
+
+    // Tidy up
+    ReleaseCellList();
+
+    NKern::ThreadLeaveCS();
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::FetchCellList() - END - r: %d", r));
+	return r;
+    }
+
+
+
+TInt DMemSpyDriverLogChanHeapDataBase::CalculateCellListBufferSize() const
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::CalculateCellListBufferSize() - START" ));
+
+    const TInt count = iCellList.Count();
+    const TInt entrySize = sizeof( TInt32 ) + sizeof( TInt32 ) + sizeof( TUint32 );
+    const TInt r = ( count * entrySize ) + sizeof( TInt ); // Extra TInt to hold count
+                
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::CalculateCellListBufferSize() - END - r: %d, count: %d, entrySize: %d", r, count, entrySize ));
+	return r;
+    }
+
+
+
+void DMemSpyDriverLogChanHeapDataBase::ReleaseCellList()
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::ReleaseCellList() - START - this: 0x%08x", this ));
+
+    NKern::ThreadEnterCS();
+    iCellList.Reset();
+    delete iHeapStream;
+    iHeapStream = NULL;
+    NKern::ThreadLeaveCS();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::ReleaseCellList() - END - this: 0x%08x", this ));
+    }
+
+TBool DMemSpyDriverLogChanHeapDataBase::HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt /*aNestingLevel*/, TInt /*aAllocNumber*/)
+    {
+	TInt err = KErrNone;
+    if (((aCellType & EMemSpyDriverFreeCellMask) && iHeapInfoParams.iBuildFreeCellList) || 
+        ((aCellType & EMemSpyDriverAllocatedCellMask) && iHeapInfoParams.iBuildAllocCellList))
+		{
+		TMemSpyDriverCell cell;
+		cell.iType = aCellType;
+		cell.iAddress = aCellAddress;
+		cell.iLength = aLength;
+
+		NKern::ThreadEnterCS();
+		err = iCellList.Append(cell);
+		NKern::ThreadLeaveCS();
+		}
+	return err == KErrNone;
+	}
+
+void DMemSpyDriverLogChanHeapDataBase::HandleHeapWalkInit()
+	{
+	}
+
+TInt DMemSpyDriverLogChanHeapDataBase::GetFullData( TMemSpyDriverInternalHeapDataParams* aParams )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::GetFullData() - START"));
+
+    TMemSpyDriverInternalHeapDataParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalHeapDataParams) );
+    //
+    if  ( r == KErrNone )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::GetFullData - thread id: %d, remaining: %8d, vtable: 0x%08x", params.iTid, params.iRemaining, params.iRHeapVTable));
+
+        // NB: The two 'get heap data' functions return either an error ( < KErrNone ) or then
+        // return the length of the descriptor data that was written to the client's address
+        // space.
+        //
+        r = GetFullData( params );
+
+        // Write back to user space if everything went okay. Remember that the 
+        // return value above will be the length of data that was written to the
+        // client if there was no error.
+        if  ( r >= KErrNone )
+            {
+            const TInt clientDescriptorLength = r;
+
+            // Make sure we update client's remaining data
+            r = Kern::ThreadRawWrite( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalHeapDataParams) );
+            
+            // ... and if that went okay, then we return the length of the descriptor data
+            // back to the client.
+            if  ( r == KErrNone )
+                {
+                r = clientDescriptorLength;
+                }
+            }
+        }
+    else
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::GetFullData - params read error: %d", r));
+        }
+
+    // Done
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::GetFullData() - END - ret: %d", r));
+    return r;
+    }
+
+TInt DMemSpyDriverLogChanHeapDataBase::DoGetFullData(TMemSpyDriverInternalHeapDataParams& aParams, 
+                                                     DThread* aThread, 
+                                                     RMemSpyDriverRHeapBase& aHeap)
+    {
+    TInt r = KErrNone;
+    if  ( aParams.iChecksum != 0 )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - checksum validation requested - expecting: 0x%08x", aParams.iChecksum ) );
+        
+        RMemSpyDriverHeapWalker heapWalker(aHeap);
+        
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - starting traversal..." ));
+#if ( defined( TRACE_TYPE_USERHEAP ) && defined( TRACE_TYPE_HEAPWALK ) )
+        heapWalker.SetPrintDebug();
+#endif
+        r = heapWalker.Traverse();
+        const TUint32 calculatedChecksum = heapWalker.Stats().iFreeCellCRC;
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - finished traversal - err: %d, checksum: 0x%08x", r, calculatedChecksum ));
+
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - comparing CALCULATED: 0x%08x vs EXPECTED: 0x%08x", calculatedChecksum, aParams.iChecksum ));
+        if  ( calculatedChecksum != aParams.iChecksum )
+            {
+            Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - comparing CALCULATED: 0x%08x vs EXPECTED: 0x%08x for thread %O", calculatedChecksum, aParams.iChecksum, aThread );
+            r = KErrCorrupt;
+            }
+        }
+
+    // Get user side (MemSpyApp) descriptor length info
+    if  ( r == KErrNone )
+        {
+        TInt destLen = 0;
+        TInt destMax = 0;
+        TUint8* destPtr = NULL;
+        r = Kern::ThreadGetDesInfo( &ClientThread(), aParams.iDes, destLen, destMax, destPtr, ETrue );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", aParams.iDes, destPtr, destLen, destMax, r ));
+        destMax = destMax & ~(KPageSize-1); // Round down dest max to page size
+        if (destMax <= 0 || (aParams.iReadAddress & (KPageSize-1)))
+            {
+            // If destMax is less than a page or the read address isn't a multiple of page size then we don't want to know
+            r = KErrArgument;
+            }
+
+        if  ( r == KErrNone )
+            {
+            const TLinAddr chunkBase = aHeap.ChunkBase(); 
+            const TLinAddr chunkMaxAddr = chunkBase + OSAdaption().DChunk().GetMaxSize(aHeap.Chunk());
+            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - chunkBase:    0x%08x", chunkBase) );
+
+            TLinAddr readAddress = aParams.iReadAddress;
+            if (aParams.iRemaining < 0 )
+                {
+                // Initial case, start from the bottom
+                readAddress = chunkBase;
+                aParams.iRemaining = aHeap.Helper()->CommittedSize();
+                }
+
+            // The remaining number of bytes should allow us to calculate the position
+            // to read from.
+            TInt amountToRead = Min( aParams.iRemaining, destMax );
+            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - amountToRead:           %8d", amountToRead) );
+
+            // Do the read from the heap we are spying on into MemSpy's address space
+            do
+                {
+                r = Kern::ThreadRawRead( aThread, (const void*)readAddress, destPtr, amountToRead );
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataBase::DoGetFullData - reading %d bytes starting at 0x%08x result: %d", 
+                                     amountToRead, readAddress, r) );
+
+                if (r == KErrBadDescriptor)
+                    {
+                    // This is not necessarily an error - it could be we've hit an unmapped page
+                    if (amountToRead > KPageSize)
+                        {
+                        // retry reading a single page instead
+                        amountToRead = KPageSize;
+                        }
+                    else
+                        {
+                        // Try the next page
+                        readAddress += KPageSize;
+                        }
+                    }
+                } while (r == KErrBadDescriptor && readAddress < chunkMaxAddr);
+            //
+            if  (r == KErrNone)
+                {
+                // Client takes care of updating descriptor length.
+                r = amountToRead;
+                }
+
+            // Update remaining bytes
+            aParams.iRemaining -= amountToRead;
+            aParams.iReadAddress = readAddress;
+            }
+        }
+    return r;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapDataKernel.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,461 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyDriverLogChanHeapDataKernel.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.h>
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverHeap.h"
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverHeapWalker.h"
+#include "MemSpyDriverUserEventMonitor.h"
+#include "MemSpyDriverSuspensionManager.h"
+
+DMemSpyDriverLogChanHeapDataKernel::DMemSpyDriverLogChanHeapDataKernel( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanHeapDataBase( aDevice, aThread ), iKernelHeap( aDevice.OSAdaption() )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::DMemSpyDriverLogChanHeapDataKernel() - this: 0x%08x", this ));
+    }
+
+TInt DMemSpyDriverLogChanHeapDataKernel::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanHeapBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+        if  ( aFunction != EMemSpyDriverOpCodeHeapKernelDataFetchCellList )
+            {
+            ReleaseCellList();
+            }
+        //
+        switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeHeapKernelDataGetInfo:
+            r = GetInfoData( (TMemSpyDriverInternalHeapRequestParameters*) a1 );
+            break;
+        case EMemSpyDriverOpCodeHeapKernelDataGetIsDebugKernel:
+            r = GetIsDebugKernel(a1);
+            break;
+        case EMemSpyDriverOpCodeHeapKernelDataFetchCellList:
+            r = FetchCellList( (TDes8*) a1 );
+            break;
+        case EMemSpyDriverOpCodeHeapKernelDataCopyHeap:
+            r = MakeKernelHeapCopy();
+            break;
+        case EMemSpyDriverOpCodeHeapKernelDataGetFull:
+            r = DMemSpyDriverLogChanHeapDataBase::GetFullData( (TMemSpyDriverInternalHeapDataParams*) a1 );
+            break;
+        case EMemSpyDriverOpCodeHeapKernelDataFreeHeapCopy:
+            FreeKernelHeapCopy();
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+            }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanHeapDataKernel::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeHeapKernelDataBase && aFunction < EMemSpyDriverOpCodeHeapKernelDataEnd );
+    }
+
+TInt DMemSpyDriverLogChanHeapDataKernel::GetInfoData( TMemSpyDriverInternalHeapRequestParameters* aParams )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData() - START" ) );
+
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &iHeapInfoParams, sizeof(TMemSpyDriverInternalHeapRequestParameters) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoDataUser - params read error: %d", r));
+        }
+    else
+        {
+        if (iHeapInfoParams.iUseKernelHeapCopy)
+            {
+            __ASSERT_ALWAYS( iKernelHeap.IsOpen(), MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapKernelCopyExpected ) );
+            r = DMemSpyDriverLogChanHeapDataKernel::GetInfoData(iKernelHeap);
+            }
+        else
+            {
+            RMemSpyDriverRHeapKernelInPlace rHeap(OSAdaption());
+            r = rHeap.OpenKernelHeap();
+            if  ( r == KErrNone )
+                {
+                r = DMemSpyDriverLogChanHeapDataKernel::GetInfoData(rHeap);
+                }
+            else 
+                {
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData() - open err: %d", r ) );                
+                }
+            }
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData() - END - ret: %d", r) );
+    return r;
+    }
+
+TInt DMemSpyDriverLogChanHeapDataKernel::GetInfoData(RMemSpyDriverRHeapBase& aHeap)
+    {
+    NKern::ThreadEnterCS();
+
+    TInt r = KErrNone;
+    
+    // This object holds all of the info we will accumulate for the client.
+    TMemSpyHeapInfo masterHeapInfo;
+    masterHeapInfo.SetType(aHeap.GetTypeFromHelper());
+    masterHeapInfo.SetTid( 2 );
+    masterHeapInfo.SetPid( 1 );
+
+    // This is the RHeap-specific object that contains all RHeap info
+    TMemSpyHeapInfoRHeap& rHeapInfo = masterHeapInfo.AsRHeap();
+
+    // We must walk the heap in order to build statistics
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData - calling heap walker constructor..."));
+    RMemSpyDriverHeapWalker heapWalker(aHeap);
+    if  (iHeapInfoParams.iBuildFreeCellList || iHeapInfoParams.iBuildAllocCellList)
+        {
+        heapWalker.SetObserver( this );
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData - collecting cells"));
+        }
+    else
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData - not collecting cells"));
+        }
+
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData - starting traversal..." ));
+
+#if defined( TRACE_TYPE_KERNELHEAP )
+    heapWalker.SetPrintDebug();
+#endif
+    if (r == KErrNone) r = heapWalker.Traverse();
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData - finished traversal - err: %d", r ));
+
+    TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
+    heapWalker.CopyStatsTo( rHeapStats );
+
+    // Get remaining meta data that isn't stored elsewhere
+    TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
+    TFullName chunkName;
+    aHeap.Chunk().FullName(chunkName);
+    rHeapMetaData.SetChunkName(chunkName);
+    rHeapMetaData.SetChunkSize( (TUint) aHeap.Chunk().Size() );
+    rHeapMetaData.SetChunkHandle( &aHeap.Chunk() );
+    rHeapMetaData.SetChunkBaseAddress( OSAdaption().DChunk().GetBase(aHeap.Chunk()) );
+    rHeapMetaData.SetDebugAllocator(aHeap.Helper()->AllocatorIsUdeb());
+    rHeapMetaData.SetUserThread( EFalse );
+    rHeapMetaData.SetSharedHeap( ETrue );
+    rHeapMetaData.iHeapSize = aHeap.Helper()->CommittedSize();
+    rHeapMetaData.iAllocatorAddress = (TAny*)aHeap.Helper()->AllocatorAddress();
+    rHeapMetaData.iMinHeapSize = aHeap.Helper()->MinCommittedSize();
+    rHeapMetaData.iMaxHeapSize = aHeap.Helper()->MaxCommittedSize();
+
+    PrintHeapInfo( masterHeapInfo );
+
+    // Write free cells if requested
+    if  ( r == KErrNone && (iHeapInfoParams.iBuildFreeCellList || iHeapInfoParams.iBuildAllocCellList))
+    	{
+        r = PrepareCellListTransferBuffer();
+        }
+
+    if  ( r >= KErrNone )
+    	{
+        // Write results back to user-side
+        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData - writing to user-side..."));
+        TMemSpyHeapInfo* kernelMasterInfo = iHeapInfoParams.iMasterInfo;
+        const TInt error = Kern::ThreadRawWrite( &ClientThread(), kernelMasterInfo, &masterHeapInfo, sizeof(TMemSpyHeapInfo) );
+        if  ( error < 0 )
+        	{
+            r = error;
+        	}
+        }
+
+    NKern::ThreadLeaveCS();
+    
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetInfoData() - END - ret: %d", r) );
+    return r;
+    }
+
+TInt DMemSpyDriverLogChanHeapDataKernel::GetIsDebugKernel(TAny* aResult)
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetIsDebugKernel() - START") );
+    
+    TInt r = KErrNone;
+    TBool debugKernel = EFalse;
+
+    NKern::ThreadEnterCS();
+    
+    RMemSpyDriverRHeapKernelInPlace rHeap(OSAdaption());
+    r = rHeap.OpenKernelHeap();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetIsDebugKernel() - open kernel heap returned: %d", r) );
+
+    if  ( r == KErrNone )
+        {
+        debugKernel = rHeap.Helper()->AllocatorIsUdeb();
+
+        // Tidy up
+        rHeap.Close();
+        }
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetIsDebugKernel() - debugKernel: %d", debugKernel) );
+
+    // Write back to user-land
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetIsDebugKernel() - writing to user-side...") );
+    r = Kern::ThreadRawWrite( &ClientThread(), aResult, &debugKernel, sizeof(TBool) );
+
+    NKern::ThreadLeaveCS();
+
+ 	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetIsDebugKernel() - END - ret: %d", r) );
+    return r;
+    }
+
+TInt DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap( RMemSpyDriverRHeapKernelFromCopy& aHeap )
+    {
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - START") );
+
+    RAllocatorHelper kernelHeapHelper;
+    TInt r = kernelHeapHelper.OpenKernelHeap();
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - open err: %d", r ) );
+    if  ( r == KErrNone )
+        {
+        DChunk* kernelChunk = kernelHeapHelper.OpenUnderlyingChunk();
+        if (kernelChunk) {
+            // TODO can we lock just the kernel heap here to avoid the problem below?
+            
+            // Make a new chunk that we can copy the kernel heap into. We cannot lock the system the entire time
+            // we need to do this, therefore there is no guarantee that the chunk will be large enough to hold the
+            // (current) heap data at the time we need to make the copy. We oversize the chunk by 1mb in the "hope"
+            // that it will be enough... :(
+            TChunkCreateInfo info;
+            info.iType         = TChunkCreateInfo::ESharedKernelSingle;
+            info.iMaxSize      = kernelChunk->MaxSize() + ( 1024 * 1024 );
+            info.iOwnsMemory   = ETrue; // Use memory from system's free pool
+            info.iDestroyedDfc = NULL;
+            #ifdef __EPOC32__
+            info.iMapAttr      = (TInt)EMapAttrFullyBlocking; // Full caching
+            #endif
+            
+            // Holds a copy of the client's heap chunk
+            DChunk* heapCopyChunk;
+            TLinAddr heapCopyChunkAddress;
+            TUint32 heapCopyChunkMappingAttributes;
+            r = Kern::ChunkCreate( info, heapCopyChunk, heapCopyChunkAddress, heapCopyChunkMappingAttributes );
+            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - creating chunk returned: %d", r));
+    
+            // Unfortunately we have to commit every page in the copied chunk irrespective of whether that's the case
+            // with the kernel chunk due to mutex ordering enforced by the kernel. See the note about this below.  
+            // This results in waste but with the way the kernel heap currently works it's not too bad.
+            // TODO fix this so it's more generic and doesn't rely on details of how the kernel heap works.
+            r = Kern::ChunkCommit(heapCopyChunk, 0, info.iMaxSize);            
+            
+            // Keep track of the pages we need to de-commit from the copy
+            // We allocate enough space here so we don't attempt to resise
+            TLinAddr* pageAddrsToDeCommit = new TLinAddr[info.iMaxSize / KPageSize];
+            TUint pageAddrsToDeCommitIndex = 0;
+            
+            TBool cleanupCopyChunk = EFalse;
+            if  ( r == KErrNone )
+                {
+                HBuf8* data = HBuf8::New(KPageSize);
+                if (data)
+                    {
+                    TAny* dataPtr = (TAny*) data->Ptr();
+                
+                    r = kernelHeapHelper.TryLock();
+                    TInt actualKernelChunkSize = kernelChunk->Size();
+                    
+                    if ( r == KErrNone )
+                        {
+                        
+                        // We now attempt to copy the kernel heap page by page
+                        // This is because the kernel chunk is disconnected and hence can have pages
+                        // in the middle of the heap that havent' been committed yet.
+                        // TODO can we make this more efficient?
+                        TInt err = KErrNone;
+                        TUint8* kernChunkAddr = kernelChunk->Base();
+                        TUint8* copyChunkAddr = (TUint8*) heapCopyChunkAddress;
+                        while(err == KErrNone && 
+                              kernChunkAddr < kernelChunk->Base() + kernelChunk->MaxSize())
+                            {
+                            XTRAP(err, XT_DEFAULT, memcpy(dataPtr, kernChunkAddr, KPageSize));
+                            if (!err)
+                                {
+                                // It'd be nice if we could just commit the pages of the copy chunk to match 
+                                // the commited pages in the kernel heap here but that violates the following
+                                // mutex ordering:
+                                // mutex KernHeap order 8 [from kernelHeapHelper.TryLock()] vs 
+                                // mutex MemoryObjectMutex1 order 9 [from Kern::ChunkCommit()]
+                                memcpy(copyChunkAddr, dataPtr, KPageSize);
+                                }
+                            else
+                                {
+                                // This page in the kernel heap wasn't committed so we can continue onto the next   
+                                err = KErrNone;
+                                // but we do need to remember this so ...
+                                pageAddrsToDeCommit[pageAddrsToDeCommitIndex++] = (TLinAddr) copyChunkAddr;                                  
+                                }
+                            kernChunkAddr += KPageSize;    
+                            copyChunkAddr += KPageSize;
+                            }
+                        kernelHeapHelper.TryUnlock();
+                        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - copied kernel heap data" ));
+
+                        // Now remove the bits we didn't actually need to commit
+                        for(TUint i=0; i < pageAddrsToDeCommitIndex; i++) 
+                            {
+                            r = heapCopyChunk->Decommit(pageAddrsToDeCommit[i], KPageSize);
+                            if (r != KErrNone) 
+                                {
+                                break;
+                                }
+                            }
+                        if (r != KErrNone)
+                            {
+                            TInt oversizedEndLength = heapCopyChunk->Size() - actualKernelChunkSize;
+                            r = heapCopyChunk->Decommit(actualKernelChunkSize, oversizedEndLength);                                    
+                            }
+                        
+                        if (r == KErrNone)
+                            {
+                            // Transfer ownership of the copy heap chunk to the heap object.
+                            TInt offset = (TInt) heapCopyChunkAddress - (TInt) kernelChunk->Base();
+                            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - heapCopyChunkAddress: 0x%08x, kernel chunk base: 0x%08x",
+                                                    heapCopyChunkAddress, kernelChunk->Base()));
+                            r = aHeap.AssociateWithKernelChunk( kernelChunk, heapCopyChunk, heapCopyChunkAddress, offset );
+                            }
+                        else
+                            {
+                            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - failed to decommit all the unnecessary pages from the copy chunk - %d", r ));
+                            cleanupCopyChunk = ETrue;
+                            }                        
+                        }         
+                    else
+                        {
+                        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - failed to lock the kernel heap" ));
+                        cleanupCopyChunk = ETrue;
+                        }
+                    
+                    delete data;
+                    }
+                else
+                    {
+                    TRACE_KH( Kern::Printf("Failed to allocate a 4K buffer" ) );
+                    r = KErrNoMemory;
+                    cleanupCopyChunk = ETrue;
+                    }
+                }
+            else
+                {
+                TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - copy chunk create error: %d", r ) );
+                cleanupCopyChunk = ETrue;
+                }
+            
+            if (cleanupCopyChunk)
+                {
+                NKern::ThreadEnterCS();
+                Kern::ChunkClose( heapCopyChunk );
+                heapCopyChunk = NULL;
+                NKern::ThreadLeaveCS();
+                }
+            
+            delete[] pageAddrsToDeCommit;
+            pageAddrsToDeCommit = NULL;
+            }
+        else
+            {
+            TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - failed to open the kernel chunk" ) );
+            }
+        }
+    else
+        {
+        TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - failed to open the kernel heap: %d", r ) );
+        }
+    
+    kernelHeapHelper.Close();
+
+    if  ( r != KErrNone )
+        {                    
+        aHeap.Close(); // also deals with the chunk                    
+        }                           
+    
+    
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::OpenKernelHeap(CP) - END - ret: %d", r ) );
+    return r;
+    }
+
+TInt DMemSpyDriverLogChanHeapDataKernel::MakeKernelHeapCopy()
+    {
+    // First phase is to 
+    // a) Open kernel heap
+    // b) Make a copy of the heap data
+    //
+    // The driver leaves kernel context with the copy of the kernel heap still associated with MemSpy's process.
+    // The second driver call will copy the chunk data to user side and release the kernel side chunk.
+
+    iKernelHeap.Reset();
+    NKern::ThreadEnterCS();
+
+    TInt r = OpenKernelHeap( iKernelHeap );
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetFullDataInit() - open err: %d", r));
+
+    NKern::ThreadLeaveCS();
+
+    TRACE_KH( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetFullDataInit() - END - ret: %d", r));
+    return r;
+    }
+
+void DMemSpyDriverLogChanHeapDataKernel::FreeKernelHeapCopy()
+    {
+    iKernelHeap.Close();
+    }
+
+TInt DMemSpyDriverLogChanHeapDataKernel::GetFullData( TMemSpyDriverInternalHeapDataParams& aParams )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetFullData() - START") );
+
+    TInt r = OpenTempObject( aParams.iTid, EThread );
+    if  ( r != KErrNone )
+        {
+        Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetFullData() - END - thread not found");
+        return r;
+        }
+    // Don't need to check if the kernel heap contains DRM data unlike for user heaps
+
+    DThread* thread = (DThread*) TempObject();
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetFullData - thread: %O", thread) );
+
+    r = DoGetFullData(aParams, thread, iKernelHeap);
+
+    CloseTempObject();
+
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataKernel::GetFullData() - END - ret: %d", r) );
+    return r;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapDataUser.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyDriverLogChanHeapDataUser.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.h>
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverHeap.h"
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverHeapWalker.h"
+#include "MemSpyDriverUserEventMonitor.h"
+#include "MemSpyDriverSuspensionManager.h"
+
+DMemSpyDriverLogChanHeapDataUser::DMemSpyDriverLogChanHeapDataUser( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:   DMemSpyDriverLogChanHeapDataBase( aDevice, aThread )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::DMemSpyDriverLogChanHeapDataUser() - this: 0x%08x", this ));
+    }
+
+TInt DMemSpyDriverLogChanHeapDataUser::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanHeapBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+        if  ( aFunction != EMemSpyDriverOpCodeHeapUserDataFetchCellList )
+            {
+            ReleaseCellList();
+            }
+        //
+        switch( aFunction )
+		    {
+        case EMemSpyDriverOpCodeHeapUserDataGetInfo:
+            r = GetInfoData( (TMemSpyDriverInternalHeapRequestParameters*) a1 );
+            break;
+        case EMemSpyDriverOpCodeHeapUserDataFetchCellList:
+            r = FetchCellList( (TDes8*) a1 );
+            break;
+        case EMemSpyDriverOpCodeHeapUserDataGetFull:
+            r = DMemSpyDriverLogChanHeapDataBase::GetFullData( (TMemSpyDriverInternalHeapDataParams*) a1 );
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+            }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanHeapDataUser::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeHeapUserDataBase && aFunction < EMemSpyDriverOpCodeHeapUserDataEnd );
+    }
+
+TInt DMemSpyDriverLogChanHeapDataUser::GetInfoData( TMemSpyDriverInternalHeapRequestParameters* aParams )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData() - START" ) );
+
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &iHeapInfoParams, sizeof(TMemSpyDriverInternalHeapRequestParameters) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - params read error: %d", r));
+        }
+    else
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - thread id: %d, vtable: 0x%08x, debugAllocator: %d", iHeapInfoParams.iTid, iHeapInfoParams.iRHeapVTable, iHeapInfoParams.iDebugAllocator) );
+
+	    r = OpenTempObject( iHeapInfoParams.iTid, EThread );
+	    if  ( r != KErrNone )
+		    {
+    	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - thread not found") );
+            }
+        else
+            {
+            // Check that the process' thread's are suspended
+            DThread* thread = (DThread*) TempObject();
+            if  ( SuspensionManager().IsSuspended( *thread ) )
+                {
+                // Open client's heap
+                RMemSpyDriverRHeapUser rHeap( OSAdaption() );
+				r = rHeap.OpenUserHeap(*thread, iHeapInfoParams.iDebugAllocator);
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - opening client heap returned: %d", r) );
+
+                if  ( r == KErrNone )
+    {
+                    // This object holds all of the info we will accumulate for the client.
+                    TMemSpyHeapInfo masterHeapInfo;
+                    masterHeapInfo.SetType(rHeap.GetTypeFromHelper());
+                    masterHeapInfo.SetTid( iHeapInfoParams.iTid );
+                    masterHeapInfo.SetPid( OSAdaption().DThread().GetOwningProcessId( *thread ) );
+
+                    // This is the RHeap-specific object that contains all RHeap info
+                    TMemSpyHeapInfoRHeap& rHeapInfo = masterHeapInfo.AsRHeap();
+
+
+                    // We must walk the client's heap in order to build statistics
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - calling heap walker constructor..."));
+					RMemSpyDriverHeapWalker heapWalker(rHeap);
+                    if  (iHeapInfoParams.iBuildFreeCellList || iHeapInfoParams.iBuildAllocCellList)
+                        {
+                        heapWalker.SetObserver( this );
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - collecting cells"));
+                        }
+                    else
+                        {
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - not collecting cells"));
+                        }
+
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - starting traversal ..." ));
+
+#if ( defined( TRACE_TYPE_USERHEAP ) && defined( TRACE_TYPE_HEAPWALK ) )
+                    heapWalker.SetPrintDebug();
+#endif
+                    if (r == KErrNone) r = heapWalker.Traverse();
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - finished traversal - err: %d", r ));
+
+                    TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
+                    heapWalker.CopyStatsTo( rHeapStats );
+
+                    // Get remaining meta data that isn't stored elsewhere
+                    TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
+					DChunk& userHeapChunk = rHeap.Chunk();
+					TFullName chunkName;
+					userHeapChunk.FullName(chunkName);
+					rHeapMetaData.SetChunkName( chunkName );
+		            rHeapMetaData.SetChunkSize( (TUint) OSAdaption().DChunk().GetSize( userHeapChunk ) );
+					rHeapMetaData.SetChunkHandle( &userHeapChunk );
+					rHeapMetaData.SetChunkBaseAddress( OSAdaption().DChunk().GetBase( userHeapChunk ) );
+                    rHeapMetaData.SetDebugAllocator(rHeap.Helper()->AllocatorIsUdeb());
+                    rHeapMetaData.SetUserThread( ETrue );
+					rHeapMetaData.iHeapSize = rHeap.Helper()->CommittedSize();
+					rHeapMetaData.iAllocatorAddress = (TAny*)rHeap.Helper()->AllocatorAddress();
+					rHeapMetaData.iMinHeapSize = rHeap.Helper()->MinCommittedSize();
+					rHeapMetaData.iMaxHeapSize = rHeap.Helper()->MaxCommittedSize();
+
+                    PrintHeapInfo( masterHeapInfo );
+
+                    // Write free cells if requested
+                    if  ( r == KErrNone && (iHeapInfoParams.iBuildFreeCellList || iHeapInfoParams.iBuildAllocCellList))
+                        {
+                        r = PrepareCellListTransferBuffer();
+                        }
+
+                    // Update info ready for writing back to the user-side
+                    if  ( r >= KErrNone )
+                        {
+                        // Write results back to user-side
+                        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - writing to user-side..."));
+                        TMemSpyHeapInfo* userMasterInfo = iHeapInfoParams.iMasterInfo;
+                        const TInt error = Kern::ThreadRawWrite( &ClientThread(), userMasterInfo, &masterHeapInfo, sizeof(TMemSpyHeapInfo) );
+                        if  ( error < 0 )
+                            {
+                            r = error;
+                            }
+                        }
+
+                    // Release resources
+					rHeap.Close();
+                    }
+                }
+            else
+                {
+                r = KErrAccessDenied;
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData - parent process not suspended => KErrAccessDenied"));
+                }
+
+	        CloseTempObject();
+            }
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetInfoData() - END - ret: %d", r));
+    return r;
+    }
+
+TInt DMemSpyDriverLogChanHeapDataUser::GetFullData( TMemSpyDriverInternalHeapDataParams& aParams )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData() - START") );
+
+	TInt r = OpenTempObject( aParams.iTid, EThread );
+	if  ( r != KErrNone )
+		{
+    	Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData() - END - thread not found");
+		return r;
+		}
+    else 
+        {
+        const DMemSpyDriverLogChanHeapBase::TDrmMatchType drmMatchType = IsDrmThread( TempObjectAsThread() );
+
+        if  ( drmMatchType != DMemSpyDriverLogChanHeapBase::EMatchTypeNone )
+            {
+            // Check whether it's a DRM thread...
+            DThread* thread = (DThread*) TempObject();
+    	    Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData() - END - Not allowing dump of DRM heap - matchType: %d, thread: %O", drmMatchType, thread );
+            CloseTempObject();
+		    return KErrAccessDenied;
+            }
+        }
+
+    // Check that the process' thread's are suspended
+    DThread* thread = (DThread*) TempObject();
+    if  ( SuspensionManager().IsSuspended( *thread ) )
+        {
+        // Open the heap
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData - thread: %O", thread) );
+        RMemSpyDriverRHeapUser heap( OSAdaption() );
+		r = heap.OpenUserHeap(*thread, aParams.iDebugAllocator);
+		TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData - opening heap returned: %d", r) );
+        if  (r == KErrNone)
+            {
+            r = DoGetFullData(aParams, thread, heap);
+			}
+        else
+            {
+    	    Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData - couldnt open heap for thread %O, err=%d", thread, r);
+            r = KErrNotSupported;
+            }
+		heap.Close();
+        }
+    else
+        {
+        Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData - parent process not suspended => KErrAccessDenied - thread: %O", thread );
+        r = KErrAccessDenied;
+        }
+
+	CloseTempObject();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapDataUser::GetFullData() - END - ret: %d", r) );
+    return r;
+    }
--- a/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapInfo.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,418 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyDriverLogChanHeapInfo.h"
-
-// System includes
-#include <u32hal.h>
-#include <e32rom.h>
-#include <memspy/driver/memspydriverconstants.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverHeap.h"
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverHeapWalker.h"
-#include "MemSpyDriverSuspensionManager.h"
-
-
-
-DMemSpyDriverLogChanHeapInfo::DMemSpyDriverLogChanHeapInfo( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:	DMemSpyDriverLogChanHeapBase( aDevice, aThread )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::DMemSpyDriverLogChanHeapInfo() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanHeapInfo::~DMemSpyDriverLogChanHeapInfo()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::~DMemSpyDriverLogChanHeapInfo() - START - this: 0x%08x", this ));
-	ReleaseCellList();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::~DMemSpyDriverLogChanHeapInfo() - END - this: 0x%08x", this ));
-	}
-
-TInt DMemSpyDriverLogChanHeapInfo::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanHeapBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-        if  ( aFunction != EMemSpyDriverOpCodeHeapInfoFetchCellList )
-            {
-            ReleaseCellList();
-            }
-        //
-        switch( aFunction )
-		    {
-        case EMemSpyDriverOpCodeHeapInfoGetUser:
-            r = GetHeapInfoUser( (TMemSpyDriverInternalHeapRequestParameters*) a1 );
-            break;
-	    case EMemSpyDriverOpCodeHeapInfoGetKernel:
-            r = GetHeapInfoKernel( (TMemSpyDriverInternalHeapRequestParameters*) a1, (TDes8*) a2 );
-            break;
-        case EMemSpyDriverOpCodeHeapInfoGetIsDebugKernel:
-            r = GetIsDebugKernel(a1);
-            break;
-        case EMemSpyDriverOpCodeHeapInfoFetchCellList:
-            r = FetchCellList( (TDes8*) a1 );
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-            }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanHeapInfo::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeHeapInfoBase && aFunction < EMemSpyDriverOpCodeHeapInfoEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser( TMemSpyDriverInternalHeapRequestParameters* aParams )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser() - START" ) );
-
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &iHeapInfoParams, sizeof(TMemSpyDriverInternalHeapRequestParameters) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - params read error: %d", r));
-        }
-    else
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - thread id: %d, vtable: 0x%08x, debugAllocator: %d", iHeapInfoParams.iTid, iHeapInfoParams.iRHeapVTable, iHeapInfoParams.iDebugAllocator) );
-
-	    r = OpenTempObject( iHeapInfoParams.iTid, EThread );
-	    if  ( r != KErrNone )
-		    {
-    	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - thread not found") );
-            }
-        else
-            {
-            // Check that the process' thread's are suspended
-            DThread* thread = (DThread*) TempObject();
-            if  ( SuspensionManager().IsSuspended( *thread ) )
-                {
-                // Open client's heap
-                RMemSpyDriverRHeapUser rHeap( OSAdaption() );
-				r = rHeap.OpenUserHeap(*thread, iHeapInfoParams.iDebugAllocator);
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - opening client heap returned: %d", r) );
-
-                if  ( r == KErrNone )
-                    {
-                    // This object holds all of the info we will accumulate for the client.
-                    TMemSpyHeapInfo masterHeapInfo;
-                    masterHeapInfo.SetType(rHeap.GetTypeFromHelper());
-                    masterHeapInfo.SetTid( iHeapInfoParams.iTid );
-                    masterHeapInfo.SetPid( OSAdaption().DThread().GetOwningProcessId( *thread ) );
-
-                    // This is the RHeap-specific object that contains all RHeap info
-                    TMemSpyHeapInfoRHeap& rHeapInfo = masterHeapInfo.AsRHeap();
-
-
-                    // We must walk the client's heap in order to build statistics
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - calling heap walker constructor..."));
-					RMemSpyDriverHeapWalker heapWalker(rHeap);
-                    if  (iHeapInfoParams.iBuildFreeCellList || iHeapInfoParams.iBuildAllocCellList)
-                        {
-                        heapWalker.SetObserver( this );
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - collecting cells"));
-                        }
-                    else
-                        {
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - not collecting cells"));
-                        }
-
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - starting traversal openerr: %d...", r));
-
-#if ( defined( TRACE_TYPE_USERHEAP ) && defined( TRACE_TYPE_HEAPWALK ) )
-                    heapWalker.SetPrintDebug();
-#endif
-                    if (r == KErrNone) r = heapWalker.Traverse();
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - finished traversal - err: %d", r ));
-
-                    TMemSpyHeapStatisticsRHeap& rHeapStats = rHeapInfo.Statistics();
-                    heapWalker.CopyStatsTo( rHeapStats );
-
-                    // Get remaining meta data that isn't stored elsewhere
-                    TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
-					DChunk& userHeapChunk = rHeap.Chunk();
-					TFullName chunkName;
-					userHeapChunk.FullName(chunkName);
-					rHeapMetaData.SetChunkName( chunkName );
-		            rHeapMetaData.SetChunkSize( (TUint) OSAdaption().DChunk().GetSize( userHeapChunk ) );
-					rHeapMetaData.SetChunkHandle( &userHeapChunk );
-					rHeapMetaData.SetChunkBaseAddress( OSAdaption().DChunk().GetBase( userHeapChunk ) );
-                    rHeapMetaData.SetDebugAllocator(rHeap.Helper()->AllocatorIsUdeb());
-                    rHeapMetaData.SetUserThread( ETrue );
-					rHeapMetaData.iHeapSize = rHeap.Helper()->CommittedSize();
-					rHeapMetaData.iAllocatorAddress = (TAny*)rHeap.Helper()->AllocatorAddress();
-					rHeapMetaData.iMinHeapSize = rHeap.Helper()->MinCommittedSize();
-					rHeapMetaData.iMaxHeapSize = rHeap.Helper()->MaxCommittedSize();
-
-                    PrintHeapInfo( masterHeapInfo );
-
-                    // Write free cells if requested
-                    if  ( r == KErrNone && (iHeapInfoParams.iBuildFreeCellList || iHeapInfoParams.iBuildAllocCellList))
-                        {
-                        r = PrepareCellListTransferBuffer();
-                        }
-
-                    // Update info ready for writing back to the user-side
-                    if  ( r >= KErrNone )
-                        {
-                        // Write results back to user-side
-                        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - writing to user-side..."));
-                        TMemSpyHeapInfo* userMasterInfo = iHeapInfoParams.iMasterInfo;
-                        const TInt error = Kern::ThreadRawWrite( &ClientThread(), userMasterInfo, &masterHeapInfo, sizeof(TMemSpyHeapInfo) );
-                        if  ( error < 0 )
-                            {
-                            r = error;
-                            }
-                        }
-
-                    // Release resources
-					rHeap.Close();
-                    }
-                }
-            else
-                {
-                r = KErrAccessDenied;
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser - parent process not suspended => KErrAccessDenied"));
-                }
-
-	        CloseTempObject();
-            }
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoUser() - END - ret: %d", r));
-    return r;
-    }
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapInfo::GetHeapInfoKernel( TMemSpyDriverInternalHeapRequestParameters* aParams, TDes8* aTransferBuffer )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoKernel() - START - aTransferBuffer: 0x%08x", aTransferBuffer ) );
-
-    TMemSpyDriverInternalHeapRequestParameters params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalHeapRequestParameters) );
-    if  ( r == KErrNone )
-        {
-        // Open kernel heap
-        RMemSpyDriverRHeapKernelInPlace rHeap;
-        r = rHeap.OpenKernelHeap();
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoKernel() - open err: %d", r ) );
-
-        if  ( r == KErrNone )
-            {
-            r = DMemSpyDriverLogChanHeapBase::GetHeapInfoKernel(rHeap, params.iMasterInfo, aTransferBuffer);
-            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoKernel() - base class get heap info: %d", r) );
-            }
-        else 
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoKernel() - open err: %d", r ) );
-            }
-        }
-    else
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoKernel() - params read error: %d", r) );
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetHeapInfoKernel() - END - ret: %d", r) );
-    return r;
-    }
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapInfo::GetIsDebugKernel(TAny* aResult)
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetIsDebugKernel() - START") );
-    
-    TInt r = KErrNone;
-    TBool debugKernel = EFalse;
-
-    NKern::ThreadEnterCS();
-    
-    RMemSpyDriverRHeapKernelInPlace rHeap;
-    r = rHeap.OpenKernelHeap();
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetIsDebugKernel() - open kernel heap returned: %d", r) );
-
-    if  ( r == KErrNone )
-        {
-        debugKernel = rHeap.Helper()->AllocatorIsUdeb();
-
-        // Tidy up
-        rHeap.Close();
-        }
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetIsDebugKernel() - debugKernel: %d", debugKernel) );
-
-    // Write back to user-land
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetIsDebugKernel() - writing to user-side...") );
-    r = Kern::ThreadRawWrite( &ClientThread(), aResult, &debugKernel, sizeof(TBool) );
-
-    NKern::ThreadLeaveCS();
-
- 	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::GetIsDebugKernel() - END - ret: %d", r) );
-    return r;
-    }
-
-TInt DMemSpyDriverLogChanHeapInfo::PrepareCellListTransferBuffer()
-    {
-    // Transfer free cells immediately from xfer stream
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::PrepareCellListTransferBuffer() - START - iHeapStream: 0x%08x", iHeapStream ));
-    __ASSERT_ALWAYS( !iHeapStream, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapFreeCellStreamNotClosed ) );
-    //
-    TInt r = KErrNoMemory;
-    //
-    NKern::ThreadEnterCS();
-    //
-    iHeapStream = new RMemSpyMemStreamWriter();
-    if  ( iHeapStream )
-        {
-        const TInt requiredMemory = CalculateCellListBufferSize();
-        r = OpenXferStream( *iHeapStream, requiredMemory );
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::PrepareCellListTransferBuffer() - requested %d bytes for free cell list, r: %d", requiredMemory, r ));
-
-        if  ( r == KErrNone )
-            {
-            const TInt count = iCellList.Count();
-            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::PrepareCellListTransferBuffer() - cell count: %d", count ));
-            //
-            iHeapStream->WriteInt32( count );
-            for( TInt i=0; i<count; i++ )
-                {
-                const TMemSpyDriverCell& cell = iCellList[ i ];
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::PrepareCellListTransferBuffer() - storing entry: %d", i ));
-                //
-                iHeapStream->WriteInt32( cell.iType );
-                iHeapStream->WriteUint32( reinterpret_cast<TUint32>( cell.iAddress ) );
-                iHeapStream->WriteInt32( cell.iLength );
-                }
-
-            // Finished with the array now
-            iCellList.Reset();
-
-            // We return the amount of client-side memory that needs to be allocated to hold the buffer
-            r = requiredMemory;
-            }
-        }
-    //
-    NKern::ThreadLeaveCS();
-               
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::PrepareCellListTransferBuffer() - END - r: %d", r));
-	return r;
-    }
-
-
-TInt DMemSpyDriverLogChanHeapInfo::FetchCellList( TDes8* aBufferSink )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::FetchCellList() - START - iHeapStream: 0x%08x", iHeapStream ));
-    __ASSERT_ALWAYS( iHeapStream, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapFreeCellStreamNotOpen ) );
-
-    TInt r = KErrNone;
-
-    // Write buffer to client
-    NKern::ThreadEnterCS();
-    r = iHeapStream->WriteAndClose( aBufferSink );
-
-    // Tidy up
-    ReleaseCellList();
-
-    NKern::ThreadLeaveCS();
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::FetchCellList() - END - r: %d", r));
-	return r;
-    }
-
-
-
-TInt DMemSpyDriverLogChanHeapInfo::CalculateCellListBufferSize() const
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::CalculateCellListBufferSize() - START" ));
-
-    const TInt count = iCellList.Count();
-    const TInt entrySize = sizeof( TInt32 ) + sizeof( TInt32 ) + sizeof( TUint32 );
-    const TInt r = ( count * entrySize ) + sizeof( TInt ); // Extra TInt to hold count
-                
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::CalculateCellListBufferSize() - END - r: %d, count: %d, entrySize: %d", r, count, entrySize ));
-	return r;
-    }
-
-
-
-void DMemSpyDriverLogChanHeapInfo::ReleaseCellList()
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::ReleaseCellList() - START - this: 0x%08x", this ));
-
-    NKern::ThreadEnterCS();
-    iCellList.Reset();
-    delete iHeapStream;
-    iHeapStream = NULL;
-    NKern::ThreadLeaveCS();
-
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapInfo::ReleaseCellList() - END - this: 0x%08x", this ));
-    }
-
-TBool DMemSpyDriverLogChanHeapInfo::HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt /*aNestingLevel*/, TInt /*aAllocNumber*/)
-    {
-	TInt err = KErrNone;
-    if (((aCellType & EMemSpyDriverFreeCellMask) && iHeapInfoParams.iBuildFreeCellList) || 
-        ((aCellType & EMemSpyDriverAllocatedCellMask) && iHeapInfoParams.iBuildAllocCellList))
-		{
-		TMemSpyDriverCell cell;
-		cell.iType = aCellType;
-		cell.iAddress = aCellAddress;
-		cell.iLength = aLength;
-
-		NKern::ThreadEnterCS();
-		err = iCellList.Append(cell);
-		NKern::ThreadLeaveCS();
-		}
-	return err == KErrNone;
-	}
-
-void DMemSpyDriverLogChanHeapInfo::HandleHeapWalkInit()
-	{
-	}
--- a/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalk.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,538 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "MemSpyDriverLogChanHeapWalk.h"
-
-// System includes
-#include <u32hal.h>
-#include <e32rom.h>
-#include <memspy/driver/memspydriverconstants.h>
-#include <memspy/driver/memspydriverobjectsshared.h>
-
-// Shared includes
-#include "MemSpyDriverOpCodes.h"
-#include "MemSpyDriverObjectsInternal.h"
-
-// User includes
-#include "MemSpyDriverHeap.h"
-#include "MemSpyDriverUtils.h"
-#include "MemSpyDriverDevice.h"
-#include "MemSpyDriverOSAdaption.h"
-#include "MemSpyDriverSuspensionManager.h"
-
-
-
-DMemSpyDriverLogChanHeapWalk::DMemSpyDriverLogChanHeapWalk( DMemSpyDriverDevice& aDevice, DThread& aThread )
-:	DMemSpyDriverLogChanHeapBase( aDevice, aThread ), iWalkHeap( aDevice.OSAdaption() )
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::DMemSpyDriverLogChanHeapWalk() - this: 0x%08x", this ));
-    }
-
-
-DMemSpyDriverLogChanHeapWalk::~DMemSpyDriverLogChanHeapWalk()
-	{
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::~DMemSpyDriverLogChanHeapWalk() - START - this: 0x%08x", this ));
-
-    NKern::ThreadEnterCS();
-
-    WalkHeapClose();
-
-    NKern::ThreadLeaveCS();
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::~DMemSpyDriverLogChanHeapWalk() - END - this: 0x%08x", this ));
-	}
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapWalk::Request( TInt aFunction, TAny* a1, TAny* a2 )
-	{
-	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
-    if  ( r == KErrNone )
-        {
-	    switch( aFunction )
-		    {
-	    case EMemSpyDriverOpCodeWalkHeapInit:
-            r = WalkHeapInit( (TMemSpyDriverInternalWalkHeapParamsInit*) a1 );
-            break;
-        case EMemSpyDriverOpCodeWalkHeapGetCellInfo:
-            r = WalkHeapGetCellInfo( (TAny*) a1, (TMemSpyDriverInternalWalkHeapParamsCell*) a2 );
-            break;
-	    case EMemSpyDriverOpCodeWalkHeapReadCellData:
-            r = WalkHeapReadCellData( (TMemSpyDriverInternalWalkHeapCellDataReadParams*) a1 );
-            break;
-	    case EMemSpyDriverOpCodeWalkHeapNextCell:
-            r = WalkHeapNextCell( (TUint) a1, (TMemSpyDriverInternalWalkHeapParamsCell*) a2 );
-            break;
-	    case EMemSpyDriverOpCodeWalkHeapClose:
-            r = WalkHeapClose();
-            break;
-
-        default:
-            r = KErrNotSupported;
-		    break;
-		    }
-        }
-    //
-    return r;
-	}
-
-
-TBool DMemSpyDriverLogChanHeapWalk::IsHandler( TInt aFunction ) const
-    {
-    return ( aFunction > EMemSpyDriverOpCodeWalkHeapBase && aFunction < EMemSpyDriverOpCodeWalkHeapEnd );
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TInt DMemSpyDriverLogChanHeapWalk::WalkHeapInit( TMemSpyDriverInternalWalkHeapParamsInit* aParams )
-    {
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit() - START"));
-    __ASSERT_ALWAYS( !iHeapWalkInitialised && iWalkHeap.Helper() == NULL, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkPending ) );
-
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &iHeapWalkInitialParameters, sizeof(TMemSpyDriverInternalWalkHeapParamsInit) );
-    if  ( r == KErrNone )
-        {
-	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - thread id: %d, vtable: 0x%08x, debugAllocator: %d", iHeapWalkInitialParameters.iTid, iHeapWalkInitialParameters.iRHeapVTable, iHeapWalkInitialParameters.iDebugAllocator));
-
-	    r = OpenTempObject( iHeapWalkInitialParameters.iTid, EThread );
-	    if  ( r == KErrNone )
-		    {
-            // Find the chunk with the correct handle
-            DThread* thread = (DThread*) TempObject();
-            if  ( SuspensionManager().IsSuspended( *thread ) )
-                {
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - thread: %O", thread));
-
-                // Open client's heap
-                r = iWalkHeap.OpenUserHeap(*thread, iHeapWalkInitialParameters.iDebugAllocator);
-
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - opening client heap returned: %d", r) );
-
-                if  ( r == KErrNone )
-                    {
-                    // Indicates that we've initiated a walk - so we can tell whether to close
-                    // the chunk later on.
-                    iHeapWalkInitialised = ETrue;
-                    iWalkHeapCellIndex = 0;
-
-                    // Walk the client's heap
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - calling heap walker constructor..."));
-                    RMemSpyDriverHeapWalker heapWalker(iWalkHeap);
-                    
-                    TMemSpyDriverLogChanHeapWalkObserver observer( *this );
-                    heapWalker.SetObserver( &observer );
-
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - starting traversal..."));
-                    r = heapWalker.Traverse();
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - finished traversal - err: %d", r));
-                    }
-
-                // If the initialise process didn't complete successfully, then we must be sure
-                // to release the associated heap chunk
-                if  ( r < KErrNone )
-                    {
-                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - error scenario - releasing kernel heap chunk copy" ));
-                    iWalkHeap.Close();
-                    }
-                }
-            else
-                {
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - parent process not suspended => KErrAccessDenied"));
-                r = KErrAccessDenied;
-                }
-            
-	        CloseTempObject();
-            }
-        else
-            {
-    	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - thread not found"));
-		    }
-        }
-    else
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - params read error: %d", r));
-        }
-
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit() - END - ret: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell( TUint aTid, TMemSpyDriverInternalWalkHeapParamsCell* aParams )
-    {
-    const TInt walkedHeapCellCount = iWalkHeapCells.Count();
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell() - START - current cell count: %d", walkedHeapCellCount));
-    __ASSERT_ALWAYS( iHeapWalkInitialised && iWalkHeap.Helper(), MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkNotInitialised ) );
-
-    // Open the original thread
-	TInt r = OpenTempObject( aTid, EThread );
-	if  ( r == KErrNone )
-		{
-        // Get the thread handle and that we have suspended the process' threads
-        DThread* thread = (DThread*) TempObject();
-        if  ( SuspensionManager().IsSuspended( *thread ) )
-            {
-            NKern::ThreadEnterCS();
-
-            if  ( walkedHeapCellCount > 0 && iWalkHeapCellIndex >= 0 && iWalkHeapCellIndex < walkedHeapCellCount )
-                {
-                // Write back head cell to user-space
-                TMemSpyDriverInternalWalkHeapParamsCell cell( iWalkHeapCells[ iWalkHeapCellIndex++ ] );
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - returning... cellType: %1d, addr: 0x%08x, len: %8d, nestingLev: %8d, allocNum: %8d", cell.iCellType, cell.iCellAddress, cell.iLength, cell.iNestingLevel, cell.iAllocNumber ));
- 
-                r = Kern::ThreadRawWrite( &ClientThread(), aParams, &cell, sizeof(TMemSpyDriverInternalWalkHeapParamsCell) );
-                if  ( r != KErrNone )
-                    {
-    	            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - params read error: %d", r));
-                    }
-                }
-            else
-                {
-                r = KErrEof;
-                }
-
-            NKern::ThreadLeaveCS();
-            }
-        else
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - parent process not suspended => KErrAccessDenied"));
-            r = KErrAccessDenied;
-            }
-    
-        CloseTempObject();
-        }
-    else
-        {
-    	Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - thread not found");
-		}
-    //    
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell() - END - ret: %d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanHeapWalk::WalkHeapClose()
-    {
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapClose() - START"));
-    //
-    if  ( iHeapWalkInitialised )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapClose - heap walk was still open..."));
-      	NKern::ThreadEnterCS();
-
-		iWalkHeap.Close();
-
-        // Discard handled cells
-        iWalkHeapCells.Reset();
-
-        iHeapWalkInitialised = EFalse;
-
-    	NKern::ThreadLeaveCS();
-        }
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapClose() - END"));
-    return KErrNone;
-    }
-
-
-TInt DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData(TMemSpyDriverInternalWalkHeapCellDataReadParams* aParams)
-    {
-    __ASSERT_ALWAYS( iHeapWalkInitialised && iWalkHeap.Helper(), MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkNotInitialised ) );
-    //
-	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData() - START - thread id: %d, vtable: 0x%08x", iHeapWalkInitialParameters.iTid, iHeapWalkInitialParameters.iRHeapVTable));
-    //
-	TMemSpyDriverInternalWalkHeapCellDataReadParams params;
-    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalWalkHeapCellDataReadParams) );
-    if  ( r != KErrNone )
-        {
-    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData() - END - params read error: %d", r));
-        return r;
-        }
-    
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - cell: 0x%08x, readLen: %8d, writeAddr: 0x%08x", params.iCellAddress, params.iReadLen, params.iDes));
-
-    // Open the original thread
-	r = OpenTempObject( iHeapWalkInitialParameters.iTid, EThread );
-	if  ( r == KErrNone )
-		{
-        // Get the thread handle
-        DThread* thread = (DThread*) TempObject();
-
-        // Check the threads in the process are suspended
-        if  ( SuspensionManager().IsSuspended( *thread ) )
-            {
-            // Check we can find the cell in the cell list...
-            const TMemSpyDriverInternalWalkHeapParamsCell* cell = CellInfoForSpecificAddress( params.iCellAddress );
-
-            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - cell: 0x%08x for address: 0x%08x", cell, params.iCellAddress ));
-
-            if  ( cell )
-                {
-                const TInt cellLen = cell->iLength;
-                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - cellLen: %d", cellLen ));
-
-                if  ( params.iReadLen <= cellLen )
-                    {
-
-                    // Get user side descriptor length info
-         	        TInt destLen = 0;
-        	        TInt destMax = 0;
-                    TUint8* destPtr = NULL;
-
-                    r = Kern::ThreadGetDesInfo( &ClientThread(), params.iDes, destLen, destMax, destPtr, ETrue );
-        	        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", params.iDes, destPtr, destLen, destMax, r ));
-
-                    // Work out the start offset for the data...
-                    if  ( r == KErrNone && destMax >= params.iReadLen )
-                        {
-                        const TAny* srcPos = ((TUint8*) cell->iCellAddress);
-        	            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - srcPos: 0x%08x", srcPos ));
-
-                        // Read some data 
-                        r = Kern::ThreadRawRead( thread, srcPos, destPtr, params.iReadLen );
-    	                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - read from thread returned: %d", r));
-
-                        if  ( r == KErrNone )
-                            {
-                            // Client will update descriptor length in this situation.
-                            r = params.iReadLen;
-                            }
-                        }
-                    else
-                        {
-                        if  ( r != KErrBadDescriptor )
-                            {
-                            r = KErrArgument;                
-            	            Kern::Printf( "DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - error - user-descriptor isnt big enough for requested data" );
-                            }
-                        else
-                            {
-            	            Kern::Printf( "DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - error - bad or non-writable user-side descriptor" );
-                            }
-                        }
-                    }
-                else
-                    {
-                    r = KErrArgument;
-        	        Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - error - read length is bigger than cell length");
-                    }
-                }
-            else
-                {
-                r = KErrArgument;
-                Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - no cell at user supplied address!");
-                }
-            }
-        else
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - parent process not suspended => KErrAccessDenied"));
-            r = KErrAccessDenied;
-            }
-
-        CloseTempObject();
-        }
-    else
-        {
-    	Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - thread not found");
-		}
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData() - END result=%d", r));
-    return r;
-    }
-
-
-TInt DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo( TAny* aCellAddress, TMemSpyDriverInternalWalkHeapParamsCell* aParams )
-    {
-    __ASSERT_ALWAYS( iHeapWalkInitialised && iWalkHeap.Helper(), MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkNotInitialised ) );
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo() - START - thread id: %d, vtable: 0x%08x", iHeapWalkInitialParameters.iTid, iHeapWalkInitialParameters.iRHeapVTable));
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - cell: 0x%08x", aCellAddress));
-
-    // Open the original thread
-	TInt r = OpenTempObject( iHeapWalkInitialParameters.iTid, EThread );
-	if (r != KErrNone)
-		{
-    	Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo() - END - thread not found");
-		return r;
-		}
-
-    // Get the thread handle
-    DThread* thread = (DThread*) TempObject();
-
-    // Check the threads in the process are suspended
-    if  ( !SuspensionManager().IsSuspended( *thread ) )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - END - parent process not suspended => KErrAccessDenied"));
-        CloseTempObject();
-        return KErrAccessDenied;
-        }
-
-    // Check we can find the cell in the cell list...
-    const TMemSpyDriverInternalWalkHeapParamsCell* cell = CellInfoForSpecificAddress( aCellAddress );
-    if  ( cell == NULL )
-        {
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - no exact match for address: 0x%08x...", aCellAddress));
-        
-        // If the cell still wasn't found, then let's look for any heap cell that contains
-        // the client-specified address (i.e. find the heap cell that contains the specified
-        // address).
-        if  ( cell == NULL )
-            {
-            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - still couldnt find cell by exact address. Searching for the cell that contains the specified address..."));
-            cell = CellInfoForAddressWithinCellRange( aCellAddress );
-            }
-        }
-
-    if  ( cell )
-        {
-        // Have enough info to write back to client now
-        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - returning... cellType: %1d, addr: 0x%08x, len: %8d, nestingLev: %8d, allocNum: %8d", cell->iCellType, cell->iCellAddress, cell->iLength, cell->iNestingLevel, cell->iAllocNumber ));
-        r = Kern::ThreadRawWrite( &ClientThread(), aParams, cell, sizeof(TMemSpyDriverInternalWalkHeapParamsCell) );
-        }
-    else
-        {
-        r = KErrArgument;
-        Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - no cell at user supplied address!");
-        }
-    
-    CloseTempObject();
-    //
-    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo() - END result=%d", r));
-    return r;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-const TMemSpyDriverInternalWalkHeapParamsCell* DMemSpyDriverLogChanHeapWalk::CellInfoForAddressWithinCellRange( TAny* aAddress ) const
-    {
-    const TMemSpyDriverInternalWalkHeapParamsCell* ret = NULL;
-    //
-    const TInt count = iWalkHeapCells.Count();
-    for(TInt i=0; i<count; i++)
-        {
-        const TMemSpyDriverInternalWalkHeapParamsCell& item = iWalkHeapCells[i];
-        const TAny* cellExtent = (TAny*) (TUint32( item.iCellAddress ) + item.iLength);
-        //
-        if  ( aAddress >= item.iCellAddress && aAddress < cellExtent )
-            {
-            ret = &item;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-const TMemSpyDriverInternalWalkHeapParamsCell* DMemSpyDriverLogChanHeapWalk::CellInfoForSpecificAddress( TAny* aAddress ) const
-    {
-    const TMemSpyDriverInternalWalkHeapParamsCell* ret = NULL;
-    //
-    const TInt count = iWalkHeapCells.Count();
-    for(TInt i=0; i<count; i++)
-        {
-        const TMemSpyDriverInternalWalkHeapParamsCell& item = iWalkHeapCells[i];
-        if  ( item.iCellAddress == aAddress )
-            {
-            ret = &item;
-            }
-        }
-    //
-    return ret;
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-TBool DMemSpyDriverLogChanHeapWalk::WalkerHandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
-    {
-    TInt error = KErrNone;
-    //
-    if  ( iHeapWalkInitialised )
-        {
-        TMemSpyDriverInternalWalkHeapParamsCell cell;
-        cell.iCellType = aCellType;
-	    cell.iCellAddress = aCellAddress;
-	    cell.iLength = aLength;
-	    cell.iNestingLevel = aNestingLevel;
-	    cell.iAllocNumber = aAllocNumber;
-        //
-  	    NKern::ThreadEnterCS();
-        error = iWalkHeapCells.Append( cell );
-  	    NKern::ThreadLeaveCS();
-        }
-    //
-    return ( error == KErrNone );
-    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/Kernel/Source/SubChannels/MemSpyDriverLogChanHeapWalkUser.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,538 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "MemSpyDriverLogChanHeapWalkUser.h"
+
+// System includes
+#include <u32hal.h>
+#include <e32rom.h>
+#include <memspy/driver/memspydriverconstants.h>
+#include <memspy/driver/memspydriverobjectsshared.h>
+
+// Shared includes
+#include "MemSpyDriverOpCodes.h"
+#include "MemSpyDriverObjectsInternal.h"
+
+// User includes
+#include "MemSpyDriverHeap.h"
+#include "MemSpyDriverUtils.h"
+#include "MemSpyDriverDevice.h"
+#include "MemSpyDriverOSAdaption.h"
+#include "MemSpyDriverSuspensionManager.h"
+
+
+
+DMemSpyDriverLogChanHeapWalkUser::DMemSpyDriverLogChanHeapWalkUser( DMemSpyDriverDevice& aDevice, DThread& aThread )
+:	DMemSpyDriverLogChanHeapBase( aDevice, aThread ), iWalkHeap( aDevice.OSAdaption() )
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::DMemSpyDriverLogChanHeapWalk() - this: 0x%08x", this ));
+    }
+
+
+DMemSpyDriverLogChanHeapWalkUser::~DMemSpyDriverLogChanHeapWalkUser()
+	{
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::~DMemSpyDriverLogChanHeapWalk() - START - this: 0x%08x", this ));
+
+    NKern::ThreadEnterCS();
+
+    WalkHeapClose();
+
+    NKern::ThreadLeaveCS();
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::~DMemSpyDriverLogChanHeapWalk() - END - this: 0x%08x", this ));
+	}
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanHeapWalkUser::Request( TInt aFunction, TAny* a1, TAny* a2 )
+	{
+	TInt r = DMemSpyDriverLogChanBase::Request( aFunction, a1, a2 );
+    if  ( r == KErrNone )
+        {
+	    switch( aFunction )
+		    {
+	    case EMemSpyDriverOpCodeHeapUserWalkInit:
+            r = WalkHeapInit( (TMemSpyDriverInternalWalkHeapParamsInit*) a1 );
+            break;
+        case EMemSpyDriverOpCodeHeapUserWalkGetCellInfo:
+            r = WalkHeapGetCellInfo( (TAny*) a1, (TMemSpyDriverInternalWalkHeapParamsCell*) a2 );
+            break;
+	    case EMemSpyDriverOpCodeHeapUserWalkReadCellData:
+            r = WalkHeapReadCellData( (TMemSpyDriverInternalWalkHeapCellDataReadParams*) a1 );
+            break;
+	    case EMemSpyDriverOpCodeHeapUserWalkNextCell:
+            r = WalkHeapNextCell( (TUint) a1, (TMemSpyDriverInternalWalkHeapParamsCell*) a2 );
+            break;
+	    case EMemSpyDriverOpCodeHeapUserWalkClose:
+            r = WalkHeapClose();
+            break;
+
+        default:
+            r = KErrNotSupported;
+		    break;
+		    }
+        }
+    //
+    return r;
+	}
+
+
+TBool DMemSpyDriverLogChanHeapWalkUser::IsHandler( TInt aFunction ) const
+    {
+    return ( aFunction > EMemSpyDriverOpCodeHeapUserWalkBase && aFunction < EMemSpyDriverOpCodeHeapUserWalkEnd );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TInt DMemSpyDriverLogChanHeapWalkUser::WalkHeapInit( TMemSpyDriverInternalWalkHeapParamsInit* aParams )
+    {
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit() - START"));
+    __ASSERT_ALWAYS( !iHeapWalkInitialised && iWalkHeap.Helper() == NULL, MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkPending ) );
+
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &iHeapWalkInitialParameters, sizeof(TMemSpyDriverInternalWalkHeapParamsInit) );
+    if  ( r == KErrNone )
+        {
+	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - thread id: %d, vtable: 0x%08x, debugAllocator: %d", iHeapWalkInitialParameters.iTid, iHeapWalkInitialParameters.iRHeapVTable, iHeapWalkInitialParameters.iDebugAllocator));
+
+	    r = OpenTempObject( iHeapWalkInitialParameters.iTid, EThread );
+	    if  ( r == KErrNone )
+		    {
+            // Find the chunk with the correct handle
+            DThread* thread = (DThread*) TempObject();
+            if  ( SuspensionManager().IsSuspended( *thread ) )
+                {
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - thread: %O", thread));
+
+                // Open client's heap
+                r = iWalkHeap.OpenUserHeap(*thread, iHeapWalkInitialParameters.iDebugAllocator);
+
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - opening client heap returned: %d", r) );
+
+                if  ( r == KErrNone )
+                    {
+                    // Indicates that we've initiated a walk - so we can tell whether to close
+                    // the chunk later on.
+                    iHeapWalkInitialised = ETrue;
+                    iWalkHeapCellIndex = 0;
+
+                    // Walk the client's heap
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - calling heap walker constructor..."));
+                    RMemSpyDriverHeapWalker heapWalker(iWalkHeap);
+                    
+                    TMemSpyDriverLogChanHeapWalkObserver observer( *this );
+                    heapWalker.SetObserver( &observer );
+
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - starting traversal..."));
+                    r = heapWalker.Traverse();
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - finished traversal - err: %d", r));
+                    }
+
+                // If the initialise process didn't complete successfully, then we must be sure
+                // to release the associated heap chunk
+                if  ( r < KErrNone )
+                    {
+                    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - error scenario - releasing kernel heap chunk copy" ));
+                    iWalkHeap.Close();
+                    }
+                }
+            else
+                {
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - parent process not suspended => KErrAccessDenied"));
+                r = KErrAccessDenied;
+                }
+            
+	        CloseTempObject();
+            }
+        else
+            {
+    	    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - thread not found"));
+		    }
+        }
+    else
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit - params read error: %d", r));
+        }
+
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapInit() - END - ret: %d", r));
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanHeapWalkUser::WalkHeapNextCell( TUint aTid, TMemSpyDriverInternalWalkHeapParamsCell* aParams )
+    {
+    const TInt walkedHeapCellCount = iWalkHeapCells.Count();
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell() - START - current cell count: %d", walkedHeapCellCount));
+    __ASSERT_ALWAYS( iHeapWalkInitialised && iWalkHeap.Helper(), MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkNotInitialised ) );
+
+    // Open the original thread
+	TInt r = OpenTempObject( aTid, EThread );
+	if  ( r == KErrNone )
+		{
+        // Get the thread handle and that we have suspended the process' threads
+        DThread* thread = (DThread*) TempObject();
+        if  ( SuspensionManager().IsSuspended( *thread ) )
+            {
+            NKern::ThreadEnterCS();
+
+            if  ( walkedHeapCellCount > 0 && iWalkHeapCellIndex >= 0 && iWalkHeapCellIndex < walkedHeapCellCount )
+                {
+                // Write back head cell to user-space
+                TMemSpyDriverInternalWalkHeapParamsCell cell( iWalkHeapCells[ iWalkHeapCellIndex++ ] );
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - returning... cellType: %1d, addr: 0x%08x, len: %8d, nestingLev: %8d, allocNum: %8d", cell.iCellType, cell.iCellAddress, cell.iLength, cell.iNestingLevel, cell.iAllocNumber ));
+ 
+                r = Kern::ThreadRawWrite( &ClientThread(), aParams, &cell, sizeof(TMemSpyDriverInternalWalkHeapParamsCell) );
+                if  ( r != KErrNone )
+                    {
+    	            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - params read error: %d", r));
+                    }
+                }
+            else
+                {
+                r = KErrEof;
+                }
+
+            NKern::ThreadLeaveCS();
+            }
+        else
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - parent process not suspended => KErrAccessDenied"));
+            r = KErrAccessDenied;
+            }
+    
+        CloseTempObject();
+        }
+    else
+        {
+    	Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell - thread not found");
+		}
+    //    
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapNextCell() - END - ret: %d", r));
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanHeapWalkUser::WalkHeapClose()
+    {
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapClose() - START"));
+    //
+    if  ( iHeapWalkInitialised )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapClose - heap walk was still open..."));
+      	NKern::ThreadEnterCS();
+
+		iWalkHeap.Close();
+
+        // Discard handled cells
+        iWalkHeapCells.Reset();
+
+        iHeapWalkInitialised = EFalse;
+
+    	NKern::ThreadLeaveCS();
+        }
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapClose() - END"));
+    return KErrNone;
+    }
+
+
+TInt DMemSpyDriverLogChanHeapWalkUser::WalkHeapReadCellData(TMemSpyDriverInternalWalkHeapCellDataReadParams* aParams)
+    {
+    __ASSERT_ALWAYS( iHeapWalkInitialised && iWalkHeap.Helper(), MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkNotInitialised ) );
+    //
+	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData() - START - thread id: %d, vtable: 0x%08x", iHeapWalkInitialParameters.iTid, iHeapWalkInitialParameters.iRHeapVTable));
+    //
+	TMemSpyDriverInternalWalkHeapCellDataReadParams params;
+    TInt r = Kern::ThreadRawRead( &ClientThread(), aParams, &params, sizeof(TMemSpyDriverInternalWalkHeapCellDataReadParams) );
+    if  ( r != KErrNone )
+        {
+    	TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData() - END - params read error: %d", r));
+        return r;
+        }
+    
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - cell: 0x%08x, readLen: %8d, writeAddr: 0x%08x", params.iCellAddress, params.iReadLen, params.iDes));
+
+    // Open the original thread
+	r = OpenTempObject( iHeapWalkInitialParameters.iTid, EThread );
+	if  ( r == KErrNone )
+		{
+        // Get the thread handle
+        DThread* thread = (DThread*) TempObject();
+
+        // Check the threads in the process are suspended
+        if  ( SuspensionManager().IsSuspended( *thread ) )
+            {
+            // Check we can find the cell in the cell list...
+            const TMemSpyDriverInternalWalkHeapParamsCell* cell = CellInfoForSpecificAddress( params.iCellAddress );
+
+            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - cell: 0x%08x for address: 0x%08x", cell, params.iCellAddress ));
+
+            if  ( cell )
+                {
+                const TInt cellLen = cell->iLength;
+                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - cellLen: %d", cellLen ));
+
+                if  ( params.iReadLen <= cellLen )
+                    {
+
+                    // Get user side descriptor length info
+         	        TInt destLen = 0;
+        	        TInt destMax = 0;
+                    TUint8* destPtr = NULL;
+
+                    r = Kern::ThreadGetDesInfo( &ClientThread(), params.iDes, destLen, destMax, destPtr, ETrue );
+        	        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - user side descriptor: 0x%08x (0x%08x), len: %8d, maxLen: %8d, r: %d", params.iDes, destPtr, destLen, destMax, r ));
+
+                    // Work out the start offset for the data...
+                    if  ( r == KErrNone && destMax >= params.iReadLen )
+                        {
+                        const TAny* srcPos = ((TUint8*) cell->iCellAddress);
+        	            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - srcPos: 0x%08x", srcPos ));
+
+                        // Read some data 
+                        r = Kern::ThreadRawRead( thread, srcPos, destPtr, params.iReadLen );
+    	                TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - read from thread returned: %d", r));
+
+                        if  ( r == KErrNone )
+                            {
+                            // Client will update descriptor length in this situation.
+                            r = params.iReadLen;
+                            }
+                        }
+                    else
+                        {
+                        if  ( r != KErrBadDescriptor )
+                            {
+                            r = KErrArgument;                
+            	            Kern::Printf( "DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - error - user-descriptor isnt big enough for requested data" );
+                            }
+                        else
+                            {
+            	            Kern::Printf( "DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - error - bad or non-writable user-side descriptor" );
+                            }
+                        }
+                    }
+                else
+                    {
+                    r = KErrArgument;
+        	        Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - error - read length is bigger than cell length");
+                    }
+                }
+            else
+                {
+                r = KErrArgument;
+                Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - no cell at user supplied address!");
+                }
+            }
+        else
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - parent process not suspended => KErrAccessDenied"));
+            r = KErrAccessDenied;
+            }
+
+        CloseTempObject();
+        }
+    else
+        {
+    	Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData - thread not found");
+		}
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapReadCellData() - END result=%d", r));
+    return r;
+    }
+
+
+TInt DMemSpyDriverLogChanHeapWalkUser::WalkHeapGetCellInfo( TAny* aCellAddress, TMemSpyDriverInternalWalkHeapParamsCell* aParams )
+    {
+    __ASSERT_ALWAYS( iHeapWalkInitialised && iWalkHeap.Helper(), MemSpyDriverUtils::PanicThread( ClientThread(), EPanicHeapWalkNotInitialised ) );
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo() - START - thread id: %d, vtable: 0x%08x", iHeapWalkInitialParameters.iTid, iHeapWalkInitialParameters.iRHeapVTable));
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - cell: 0x%08x", aCellAddress));
+
+    // Open the original thread
+	TInt r = OpenTempObject( iHeapWalkInitialParameters.iTid, EThread );
+	if (r != KErrNone)
+		{
+    	Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo() - END - thread not found");
+		return r;
+		}
+
+    // Get the thread handle
+    DThread* thread = (DThread*) TempObject();
+
+    // Check the threads in the process are suspended
+    if  ( !SuspensionManager().IsSuspended( *thread ) )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - END - parent process not suspended => KErrAccessDenied"));
+        CloseTempObject();
+        return KErrAccessDenied;
+        }
+
+    // Check we can find the cell in the cell list...
+    const TMemSpyDriverInternalWalkHeapParamsCell* cell = CellInfoForSpecificAddress( aCellAddress );
+    if  ( cell == NULL )
+        {
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - no exact match for address: 0x%08x...", aCellAddress));
+        
+        // If the cell still wasn't found, then let's look for any heap cell that contains
+        // the client-specified address (i.e. find the heap cell that contains the specified
+        // address).
+        if  ( cell == NULL )
+            {
+            TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - still couldnt find cell by exact address. Searching for the cell that contains the specified address..."));
+            cell = CellInfoForAddressWithinCellRange( aCellAddress );
+            }
+        }
+
+    if  ( cell )
+        {
+        // Have enough info to write back to client now
+        TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - returning... cellType: %1d, addr: 0x%08x, len: %8d, nestingLev: %8d, allocNum: %8d", cell->iCellType, cell->iCellAddress, cell->iLength, cell->iNestingLevel, cell->iAllocNumber ));
+        r = Kern::ThreadRawWrite( &ClientThread(), aParams, cell, sizeof(TMemSpyDriverInternalWalkHeapParamsCell) );
+        }
+    else
+        {
+        r = KErrArgument;
+        Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo - no cell at user supplied address!");
+        }
+    
+    CloseTempObject();
+    //
+    TRACE( Kern::Printf("DMemSpyDriverLogChanHeapWalk::WalkHeapGetCellInfo() - END result=%d", r));
+    return r;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+const TMemSpyDriverInternalWalkHeapParamsCell* DMemSpyDriverLogChanHeapWalkUser::CellInfoForAddressWithinCellRange( TAny* aAddress ) const
+    {
+    const TMemSpyDriverInternalWalkHeapParamsCell* ret = NULL;
+    //
+    const TInt count = iWalkHeapCells.Count();
+    for(TInt i=0; i<count; i++)
+        {
+        const TMemSpyDriverInternalWalkHeapParamsCell& item = iWalkHeapCells[i];
+        const TAny* cellExtent = (TAny*) (TUint32( item.iCellAddress ) + item.iLength);
+        //
+        if  ( aAddress >= item.iCellAddress && aAddress < cellExtent )
+            {
+            ret = &item;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+const TMemSpyDriverInternalWalkHeapParamsCell* DMemSpyDriverLogChanHeapWalkUser::CellInfoForSpecificAddress( TAny* aAddress ) const
+    {
+    const TMemSpyDriverInternalWalkHeapParamsCell* ret = NULL;
+    //
+    const TInt count = iWalkHeapCells.Count();
+    for(TInt i=0; i<count; i++)
+        {
+        const TMemSpyDriverInternalWalkHeapParamsCell& item = iWalkHeapCells[i];
+        if  ( item.iCellAddress == aAddress )
+            {
+            ret = &item;
+            }
+        }
+    //
+    return ret;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+TBool DMemSpyDriverLogChanHeapWalkUser::WalkerHandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber )
+    {
+    TInt error = KErrNone;
+    //
+    if  ( iHeapWalkInitialised )
+        {
+        TMemSpyDriverInternalWalkHeapParamsCell cell;
+        cell.iCellType = aCellType;
+	    cell.iCellAddress = aCellAddress;
+	    cell.iLength = aLength;
+	    cell.iNestingLevel = aNestingLevel;
+	    cell.iAllocNumber = aAllocNumber;
+        //
+  	    NKern::ThreadEnterCS();
+        error = iWalkHeapCells.Append( cell );
+  	    NKern::ThreadLeaveCS();
+        }
+    //
+    return ( error == KErrNone );
+    }
--- a/perfsrv/memspy/Driver/Shared/MemSpyDriverObjectsInternal.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Shared/MemSpyDriverObjectsInternal.h	Mon Oct 04 02:45:59 2010 +0300
@@ -33,7 +33,13 @@
     {
 public:
     inline TMemSpyDriverInternalHeapRequestParameters()
-        : iTid(0), iRHeapVTable(0), iBuildFreeCellList(EFalse), iBuildAllocCellList(EFalse), iDebugAllocator(EFalse), iMasterInfo(NULL)
+        : iTid(0),
+          iRHeapVTable(0),
+          iBuildFreeCellList(EFalse),
+          iBuildAllocCellList(EFalse),
+          iUseKernelHeapCopy(EFalse),
+          iDebugAllocator(EFalse),
+          iMasterInfo(NULL)
         {
         }
 
@@ -42,6 +48,7 @@
     TUint32 iRHeapVTable;
     TBool iBuildFreeCellList;
 	TBool iBuildAllocCellList;
+	TBool iUseKernelHeapCopy;
 
 public: // Params IN or OUT (IN in User heap requests, OUT in Kernel heap requests)
     TBool iDebugAllocator;
@@ -65,8 +72,8 @@
     {
     TUint iTid;
     TUint iRHeapVTable;
-    TDes8* iDes; // Not used during kernel heap fetch
-    TInt iRemaining; // Not used during kernel heap fetch
+    TDes8* iDes;
+    TInt iRemaining;
     TUint iReadAddress;
     TUint32 iChecksum;
     TBool iDebugAllocator;
--- a/perfsrv/memspy/Driver/Shared/MemSpyDriverOpCodes.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Shared/MemSpyDriverOpCodes.h	Mon Oct 04 02:45:59 2010 +0300
@@ -51,29 +51,31 @@
     EMemSpyDriverOpCodeChunkGetInfo,
 	EMemSpyDriverOpCodeChunkEnd,
 
-    // HEAP INFO
-    EMemSpyDriverOpCodeHeapInfoBase = 180,
-	EMemSpyDriverOpCodeHeapInfoGetUser,
-	EMemSpyDriverOpCodeHeapInfoGetKernel,
-    EMemSpyDriverOpCodeHeapInfoGetIsDebugKernel,
-    EMemSpyDriverOpCodeHeapInfoFetchCellList,
-    EMemSpyDriverOpCodeHeapInfoEnd,
+    // HEAP USER DATA
+    EMemSpyDriverOpCodeHeapUserDataBase = 180,
+    EMemSpyDriverOpCodeHeapUserDataGetInfo,
+    EMemSpyDriverOpCodeHeapUserDataFetchCellList,
+    EMemSpyDriverOpCodeHeapUserDataGetFull,
+    EMemSpyDriverOpCodeHeapUserDataEnd,    
 
-    // HEAP DATA
-    EMemSpyDriverOpCodeHeapDataBase = 200,
-    EMemSpyDriverOpCodeHeapDataGetUser,
-    EMemSpyDriverOpCodeHeapDataGetKernelInit,
-    EMemSpyDriverOpCodeHeapDataGetKernelFetch,
-    EMemSpyDriverOpCodeHeapDataEnd,
-
-    // HEAP WALK
-    EMemSpyDriverOpCodeWalkHeapBase = 220,
-    EMemSpyDriverOpCodeWalkHeapInit,
-    EMemSpyDriverOpCodeWalkHeapGetCellInfo,
-    EMemSpyDriverOpCodeWalkHeapReadCellData,
-    EMemSpyDriverOpCodeWalkHeapNextCell,
-    EMemSpyDriverOpCodeWalkHeapClose,
-    EMemSpyDriverOpCodeWalkHeapEnd,
+    // HEAP KERNEL DATA
+    EMemSpyDriverOpCodeHeapKernelDataBase = 200,
+    EMemSpyDriverOpCodeHeapKernelDataGetInfo,
+    EMemSpyDriverOpCodeHeapKernelDataGetIsDebugKernel,
+    EMemSpyDriverOpCodeHeapKernelDataFetchCellList,
+    EMemSpyDriverOpCodeHeapKernelDataCopyHeap,
+    EMemSpyDriverOpCodeHeapKernelDataGetFull,
+    EMemSpyDriverOpCodeHeapKernelDataFreeHeapCopy,
+    EMemSpyDriverOpCodeHeapKernelDataEnd,    
+    
+    // HEAP USER WALK
+    EMemSpyDriverOpCodeHeapUserWalkBase = 220,
+    EMemSpyDriverOpCodeHeapUserWalkInit,
+    EMemSpyDriverOpCodeHeapUserWalkGetCellInfo,
+    EMemSpyDriverOpCodeHeapUserWalkReadCellData,
+    EMemSpyDriverOpCodeHeapUserWalkNextCell,
+    EMemSpyDriverOpCodeHeapUserWalkClose,
+    EMemSpyDriverOpCodeHeapUserWalkEnd,
 
     // STACK
     EMemSpyDriverOpCodeStackBase = 240,
--- a/perfsrv/memspy/Driver/Shared/heaputils.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Shared/heaputils.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -23,7 +23,7 @@
 
 #include <kern_priv.h>
 #define MEM Kern
-__ASSERT_COMPILE(sizeof(LtkUtils::RKernelSideAllocatorHelper) == 10*4);
+__ASSERT_COMPILE(sizeof(LtkUtils::RUserAllocatorHelper) == 10*4);
 #define KERN_ENTER_CS() NKern::ThreadEnterCS()
 #define KERN_LEAVE_CS() NKern::ThreadLeaveCS()
 #define LOG(args...)
@@ -104,6 +104,23 @@
 
 #ifdef __KERNEL_MODE__
 
+TLinAddr LtkUtils::RAllocatorHelper::GetKernelAllocator(DChunk* aKernelChunk) 
+    {    
+    TLinAddr allocatorAddress;
+#ifdef __WINS__
+    allocatorAddress = (TLinAddr)aKernelChunk->Base();
+#else
+    // Copied from P::KernelInfo
+    const TRomHeader& romHdr=Epoc::RomHeader();
+    const TRomEntry* primaryEntry=(const TRomEntry*)Kern::SuperPage().iPrimaryEntry;
+    const TRomImageHeader* primaryImageHeader=(const TRomImageHeader*)primaryEntry->iAddressLin;
+    TLinAddr stack = romHdr.iKernDataAddress + Kern::RoundToPageSize(romHdr.iTotalSvDataSize);
+    TLinAddr heap = stack + Kern::RoundToPageSize(primaryImageHeader->iStackSize);
+    allocatorAddress = heap;
+#endif
+    return allocatorAddress;
+    }
+
 TInt RAllocatorHelper::OpenKernelHeap()
 	{
 	_LIT(KName, "SvHeap");
@@ -124,18 +141,13 @@
 		}
 	iChunk = foundChunk;
     chunkContainer->Signal();
-#ifdef __WINS__
-	TInt err = OpenChunkHeap((TLinAddr)foundChunk->Base(), 0); // It looks like DChunk::iBase/DChunk::iFixedBase should both be ok for the kernel chunk
-#else
-	// Copied from P::KernelInfo
-	const TRomHeader& romHdr=Epoc::RomHeader();
-	const TRomEntry* primaryEntry=(const TRomEntry*)Kern::SuperPage().iPrimaryEntry;
-	const TRomImageHeader* primaryImageHeader=(const TRomImageHeader*)primaryEntry->iAddressLin;
-	TLinAddr stack = romHdr.iKernDataAddress + Kern::RoundToPageSize(romHdr.iTotalSvDataSize);
-	TLinAddr heap = stack + Kern::RoundToPageSize(primaryImageHeader->iStackSize);
-	TInt err = OpenChunkHeap(heap, 0); // aChunkMaxSize is only used for trying the middle of the chunk for hybrid allocatorness, and the kernel heap doesn't use that (thankfully). So we can safely pass in zero.
+
+    iAllocatorAddress = GetKernelAllocator(foundChunk);
 
-#endif
+    // It looks like DChunk::iBase/DChunk::iFixedBase should both be ok for the kernel chunk
+	// aChunkMaxSize is only used for trying the middle of the chunk for hybrid allocatorness, and the kernel heap doesn't use that (thankfully). So we can safely pass in zero.
+	TInt err = OpenChunkHeap((TLinAddr)foundChunk->Base(), 0); 
+
 	if (!err) err = FinishConstruction();
 	NKern::ThreadLeaveCS();
 	return err;
@@ -288,11 +300,11 @@
 
 #ifdef __KERNEL_MODE__
 
-LtkUtils::RKernelSideAllocatorHelper::RKernelSideAllocatorHelper()
+LtkUtils::RUserAllocatorHelper::RUserAllocatorHelper()
 	: iThread(NULL)
 	{}
 
-void LtkUtils::RKernelSideAllocatorHelper::Close()
+void LtkUtils::RUserAllocatorHelper::Close()
 	{
 	NKern::ThreadEnterCS();
 	if (iThread)
@@ -304,27 +316,27 @@
 	NKern::ThreadLeaveCS();
 	}
 
-TInt LtkUtils::RKernelSideAllocatorHelper::ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const
+TInt LtkUtils::RUserAllocatorHelper::ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const
 	{
 	return Kern::ThreadRawRead(iThread, (const TAny*)aLocation, aResult, aSize);
 	}
 
-TInt LtkUtils::RKernelSideAllocatorHelper::WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize)
+TInt LtkUtils::RUserAllocatorHelper::WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize)
 	{
 	return Kern::ThreadRawWrite(iThread, (TAny*)aLocation, aData, aSize);
 	}
 
-TInt LtkUtils::RKernelSideAllocatorHelper::TryLock()
+TInt LtkUtils::RUserAllocatorHelper::TryLock()
 	{
 	return KErrNotSupported;
 	}
 
-void LtkUtils::RKernelSideAllocatorHelper::TryUnlock()
+void LtkUtils::RUserAllocatorHelper::TryUnlock()
 	{
 	// Not supported
 	}
 
-TInt LtkUtils::RKernelSideAllocatorHelper::OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb)
+TInt LtkUtils::RUserAllocatorHelper::OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb)
 	{
 	NKern::ThreadEnterCS();
 	DObjectCon* threads = Kern::Containers()[EThread];
@@ -344,11 +356,77 @@
 	return err;
 	}
 
+LtkUtils::RKernelCopyAllocatorHelper::RKernelCopyAllocatorHelper()
+    : iCopiedChunk(NULL), iOffset(0)
+    {}
+
+TInt LtkUtils::RKernelCopyAllocatorHelper::OpenCopiedHeap(DChunk* aOriginalChunk, DChunk* aCopiedChunk, TInt aOffset)
+    {
+    TInt err = aCopiedChunk->Open();
+    if (!err)
+        {
+        iCopiedChunk = aCopiedChunk;
+        iOffset = aOffset;
+
+        // We need to set iAllocatorAddress to point to the allocator in the original chunk and not the copy
+        // because all the internal pointers will be relative to that. Instead we use iOffset in the Read / Write Data 
+        // calls
+        iAllocatorAddress = GetKernelAllocator(aOriginalChunk);
+        
+        // It looks like DChunk::iBase/DChunk::iFixedBase should both be ok for the kernel chunk
+        // aChunkMaxSize is only used for trying the middle of the chunk for hybrid allocatorness, and the kernel heap doesn't use that (thankfully). So we can safely pass in zero.
+        err = OpenChunkHeap((TLinAddr)aCopiedChunk->Base(), 0);
+        }
+    
+    return err;
+    }
+
+DChunk* LtkUtils::RKernelCopyAllocatorHelper::OpenUnderlyingChunk()
+    {
+    // We should never get here
+    __NK_ASSERT_ALWAYS(EFalse);
+    return NULL;
+    }
+
+void LtkUtils::RKernelCopyAllocatorHelper::Close()
+    {
+    if (iCopiedChunk)
+        {
+        NKern::ThreadEnterCS();
+        iCopiedChunk->Close(NULL);
+        iCopiedChunk = NULL;
+        NKern::ThreadLeaveCS();
+        }
+    iOffset = 0;
+    RAllocatorHelper::Close();
+    }
+
+TInt LtkUtils::RKernelCopyAllocatorHelper::ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const
+    {
+    memcpy(aResult, (const TAny*)(aLocation+iOffset), aSize);
+    return KErrNone;
+    }
+
+TInt LtkUtils::RKernelCopyAllocatorHelper::WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize)
+    {
+    memcpy((TAny*)(aLocation+iOffset), aData, aSize);
+    return KErrNone;
+    }
+
+TInt LtkUtils::RKernelCopyAllocatorHelper::TryLock()
+    {
+    return KErrNotSupported;
+    }
+
+void LtkUtils::RKernelCopyAllocatorHelper::TryUnlock()
+    {
+    // Not supported
+    }
+
 #endif // __KERNEL_MODE__
 
 TInt RAllocatorHelper::OpenChunkHeap(TLinAddr aChunkBase, TInt aChunkMaxSize)
 	{
-	iAllocatorAddress = aChunkBase;
 #ifdef __KERNEL_MODE__
 	// Must be in CS
 	// Assumes that this only ever gets called for the kernel heap. Otherwise goes through RKernelSideAllocatorHelper::OpenUserHeap.
@@ -1602,7 +1680,7 @@
 	return iChunk;
 	}
 
-DChunk* LtkUtils::RKernelSideAllocatorHelper::OpenUnderlyingChunk()
+DChunk* LtkUtils::RUserAllocatorHelper::OpenUnderlyingChunk()
 	{
 	if (iAllocatorType != EUrelOldRHeap && iAllocatorType != EUdebOldRHeap && iAllocatorType != EUrelHybridHeap && iAllocatorType != EUdebHybridHeap) return NULL;
 	// Note RKernelSideAllocatorHelper doesn't use or access RAllocatorHelper::iChunk, because we figure out the chunk handle in a different way.
--- a/perfsrv/memspy/Driver/Shared/heaputils.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Shared/heaputils.h	Mon Oct 04 02:45:59 2010 +0300
@@ -41,6 +41,7 @@
 public:
 	HUIMPORT_C RAllocatorHelper();
 #ifdef __KERNEL_MODE__
+	TLinAddr GetKernelAllocator(DChunk* aKernelChunk);
 	TInt OpenKernelHeap();
 #else
 	HUIMPORT_C TInt Open(RAllocator* aAllocator);
@@ -123,6 +124,12 @@
 #endif
 	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
 	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+
+#ifndef __KERNEL_MODE__
+protected:
+#else
+public:
+#endif	
 	virtual TInt TryLock();
 	virtual void TryUnlock();
 
@@ -171,22 +178,40 @@
 
 #ifdef __KERNEL_MODE__
 
-class RKernelSideAllocatorHelper : public RAllocatorHelper
-	{
+class RUserAllocatorHelper : public RAllocatorHelper
+    {
 public:
-	RKernelSideAllocatorHelper();
-	TInt OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb);
-	virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
-	virtual void Close();
+    RUserAllocatorHelper();
+    TInt OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb);
+    virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
+    virtual void Close();
 
 protected:
-	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
-	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
-	virtual TInt TryLock();
-	virtual void TryUnlock();
+    virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
+    virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+    virtual TInt TryLock();
+    virtual void TryUnlock();
 private:
-	DThread* iThread;
-	};
+    DThread* iThread;
+    };
+
+class RKernelCopyAllocatorHelper : public RAllocatorHelper
+    {
+public:
+    RKernelCopyAllocatorHelper();
+    TInt OpenCopiedHeap(DChunk* aOriginalChunk, DChunk* aCopiedChunk, TInt aOffset);
+    virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
+    virtual void Close();
+
+protected:
+    virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
+    virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+    virtual TInt TryLock();
+    virtual void TryUnlock();
+private:
+    DChunk* iCopiedChunk;
+    TInt iOffset; // from the original kernel heap to the copied heap
+    };
 
 #else
 
--- a/perfsrv/memspy/Driver/User/Source/MemSpyDriverClient.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/User/Source/MemSpyDriverClient.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -499,7 +499,7 @@
     params.iDebugAllocator = DebugEUser();
     params.iMasterInfo = &aInfo;
     //
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetUser, &params, NULL );
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapUserDataGetInfo, &params, NULL );
 	//
 	if  ( r == KErrNone )
     	{
@@ -523,13 +523,18 @@
 	return r;
     }
 
-EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoUser( TMemSpyHeapInfo& aInfo, TUint aTid, RArray< TMemSpyDriverFreeCell >& aFreeCells )
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoUser(TMemSpyHeapInfo& aInfo, 
+                                                   TUint aTid, 
+                                                   RArray< TMemSpyDriverFreeCell >& aFreeCells)
 	{
 	return GetHeapInfoUser(aInfo, aTid, aFreeCells, EFalse);
 	}
 
 // For the record I don't think this function should be exported, but since the one above was I'm going with the flow. -TomS
-EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoUser(TMemSpyHeapInfo& aInfo, TUint aTid, RArray<TMemSpyDriverCell>& aCells, TBool aCollectAllocatedCellsAsWellAsFree)
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoUser(TMemSpyHeapInfo& aInfo, 
+                                                   TUint aTid, 
+                                                   RArray<TMemSpyDriverCell>& aCells, 
+                                                   TBool aCollectAllocatedCellsAsWellAsFree)
 	{
     TMemSpyDriverInternalHeapRequestParameters params;
     //
@@ -539,11 +544,10 @@
     params.iMasterInfo = &aInfo;
     params.iBuildFreeCellList = ETrue;
 	params.iBuildAllocCellList = aCollectAllocatedCellsAsWellAsFree;
-
     //
     aCells.Reset();
     ResetStreamBuffer();
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetUser, &params );
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapUserDataGetInfo, &params );
 	//
 	if  ( r >= KErrNone )
     	{
@@ -568,7 +572,7 @@
         // Now fetch the heap data
         if  ( r == KErrNone )
             {
-            r = DoControl( EMemSpyDriverOpCodeHeapInfoFetchCellList, &iBuffer );
+            r = DoControl( EMemSpyDriverOpCodeHeapUserDataFetchCellList, &iBuffer );
             if  ( r == KErrNone )
                 {
                 TRAP( r, ReadHeapInfoFreeCellsFromXferBufferL( aCells ) );
@@ -588,10 +592,12 @@
 EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel( TMemSpyHeapInfo& aInfo )
     {
     TMemSpyDriverInternalHeapRequestParameters params;
+    //
     params.iTid = KMemSpyDriverGetKernelHeapDataPseudoThreadId;
     params.iRHeapVTable = NULL;
     params.iMasterInfo = &aInfo;
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetKernel, &params, NULL );
+    //
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapKernelDataGetInfo, &params, NULL );
 	//
 	if  ( r == KErrNone )
     	{
@@ -606,22 +612,57 @@
 	return r;
     }
 
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel(TMemSpyHeapInfo& aInfo, 
+                                                     RArray< TMemSpyDriverFreeCell >& aFreeCells)
+    {
+    return GetHeapInfoKernel(aInfo, aFreeCells, EFalse, EFalse);
+    }
 
-EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray< TMemSpyDriverFreeCell >& aFreeCells )
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel(TMemSpyHeapInfo& aInfo, 
+                                                     RArray<TMemSpyDriverCell>& aCells, 
+                                                     TBool aCollectAllocatedCellsAsWellAsFree)
+    {
+    return GetHeapInfoKernel(aInfo, aCells, aCollectAllocatedCellsAsWellAsFree, EFalse);    
+    }
+
+EXPORT_C TInt RMemSpyDriverClient::GetHeapInfoKernel(TMemSpyHeapInfo& aInfo, 
+                                                     RArray<TMemSpyDriverCell>& aCells, 
+                                                     TBool aCollectAllocatedCellsAsWellAsFree, 
+                                                     TBool aUseKernelCopy)
     {
     TMemSpyDriverInternalHeapRequestParameters params;
-    params.iTid = KMemSpyDriverGetKernelHeapDataPseudoThreadId;
+    //
+	params.iTid = KMemSpyDriverGetKernelHeapDataPseudoThreadId;
     params.iRHeapVTable = NULL;
     params.iMasterInfo = &aInfo;
+    params.iBuildFreeCellList = ETrue;
+	params.iBuildAllocCellList = aCollectAllocatedCellsAsWellAsFree;
+    params.iUseKernelHeapCopy = aUseKernelCopy;
     //
-    aFreeCells.Reset();
+    aCells.Reset();
     ResetStreamBuffer();
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapInfoGetKernel, &params, (TAny*) &iBuffer );
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapKernelDataGetInfo, &params );
 	//
-	if  ( r == KErrNone )
+	if  ( r >= KErrNone )
     	{
         PrintHeapInfo( aInfo );
-        TRAP( r, ReadHeapInfoFreeCellsFromXferBufferL( aFreeCells ) );
+        
+        // Resize transfer buffer to make room for free cells. We only make the buffer
+        // bigger, not smaller.
+        if  ( iBuffer.Size() < r )
+            {
+            r = iBuffer.ReAlloc( r );
+            }
+    
+        // Now fetch the heap data
+        if  ( r == KErrNone )
+            {
+            r = DoControl( EMemSpyDriverOpCodeHeapKernelDataFetchCellList, &iBuffer );
+            if  ( r == KErrNone )
+                {
+                TRAP( r, ReadHeapInfoFreeCellsFromXferBufferL( aCells ) );
+                }
+            }
         }
     else if ( r == KErrNotSupported )
         {
@@ -631,12 +672,12 @@
 	//
 	return r;
     }
-
+       
 
 EXPORT_C TBool RMemSpyDriverClient::IsDebugKernel()
     {
     TBool isDebugKernel = EFalse;
-    DoControl( EMemSpyDriverOpCodeHeapInfoGetIsDebugKernel, (TAny*) &isDebugKernel );
+    DoControl( EMemSpyDriverOpCodeHeapKernelDataGetIsDebugKernel, (TAny*) &isDebugKernel );
     return isDebugKernel;
     }
 
@@ -661,7 +702,11 @@
 
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetHeapData( TUint aTid, TUint32 aFreeCellChecksum, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining )
+EXPORT_C TInt RMemSpyDriverClient::GetHeapData(TUint aTid, 
+                                               TUint32 aFreeCellChecksum, 
+                                               TDes8& aDest, 
+                                               TUint& aReadAddress, 
+                                               TUint& aAmountRemaining )
     {
     TMemSpyDriverInternalHeapDataParams params;
     params.iTid = aTid;
@@ -673,7 +718,7 @@
 	params.iReadAddress = 0;
     aDest.Zero();
     //
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapDataGetUser, &params, NULL );
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapUserDataGetFull, &params, NULL );
 	//
 	if  ( r >= KErrNone )
     	{
@@ -687,7 +732,10 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetHeapDataNext( TUint aTid, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining )
+EXPORT_C TInt RMemSpyDriverClient::GetHeapDataNext(TUint aTid, 
+                                                   TDes8& aDest, 
+                                                   TUint& aReadAddress, 
+                                                   TUint& aAmountRemaining)
     {
     TMemSpyDriverInternalHeapDataParams params;
     params.iTid = aTid;
@@ -699,7 +747,7 @@
 	params.iReadAddress = aReadAddress;
     aDest.Zero();
     //
-	TInt r = DoControl( EMemSpyDriverOpCodeHeapDataGetUser, &params, NULL );
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapUserDataGetFull, &params, NULL );
 	//
 	if  ( r >= KErrNone )
     	{
@@ -713,44 +761,71 @@
     }
 
 
-
-EXPORT_C HBufC8* RMemSpyDriverClient::GetHeapDataKernelLC( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells )
+EXPORT_C TInt RMemSpyDriverClient::CopyHeapDataKernel()
     {
-    HBufC8* data = NULL;
+    return DoControl( EMemSpyDriverOpCodeHeapKernelDataCopyHeap, NULL, NULL );    
+    }
 
-    // Going to fetch free cells via stream buffer...
-    ResetStreamBuffer();
+EXPORT_C TInt RMemSpyDriverClient::FreeHeapDataKernel()
+    {
+    return DoControl( EMemSpyDriverOpCodeHeapKernelDataFreeHeapCopy, NULL, NULL );    
+    }
 
-    // First pass is to preallocate buffer for kernel heap, and fetch metadata and free cells
-    TInt sizeOrError = DoControl( EMemSpyDriverOpCodeHeapDataGetKernelInit, (TAny*) &aInfo, (TAny*) &iBuffer );
-	if  ( sizeOrError >= KErrNone )
-    	{
-        const TInt kernelHeapSize = sizeOrError;
-        if  ( aInfo.Type() != TMemSpyHeapInfo::ETypeRHeap )
-            {
-            User::Leave( KErrNotSupported );
-            }
-        else
-            {
-            // Extract free cells
-            ReadHeapInfoFreeCellsFromXferBufferL( aFreeCells );
-
-            // It's okay to treat the heap info as an RHeap
-            PrintHeapInfo( aInfo );
-
-            // Allocate data sink and do fetch
-            data = HBufC8::NewLC( kernelHeapSize );
-            TPtr8 pBuffer( data->Des() );
-
-	        sizeOrError = DoControl( EMemSpyDriverOpCodeHeapDataGetKernelFetch, &pBuffer, NULL );
-            }
+EXPORT_C TInt RMemSpyDriverClient::GetHeapDataKernel(TUint aTid, 
+                                                     TDes8& aDest, 
+                                                     TUint& aReadAddress, 
+                                                     TUint& aAmountRemaining)
+    {
+    TMemSpyDriverInternalHeapDataParams params;
+    params.iTid = aTid;
+    params.iRHeapVTable = RHeapVTable();
+    params.iDebugAllocator = DebugEUser();
+    params.iDes = &aDest;
+    params.iChecksum = 0;
+    params.iRemaining = -1;
+    params.iReadAddress = 0;
+    aDest.Zero();
+    //
+    TInt r = DoControl( EMemSpyDriverOpCodeHeapKernelDataGetFull, &params, NULL );
+    //
+    if  ( r >= KErrNone )
+        {
+        aDest.SetLength( r );
+        aReadAddress = params.iReadAddress;
+        aAmountRemaining = params.iRemaining;
+        r = KErrNone;
         }
-
-    User::LeaveIfError( sizeOrError );
-    return data;
+    return r;
     }
 
 
+EXPORT_C TInt RMemSpyDriverClient::GetHeapDataKernelNext(TUint aTid, 
+                                                         TDes8& aDest, 
+                                                         TUint& aReadAddress, 
+                                                         TUint& aAmountRemaining)
+    {
+    TMemSpyDriverInternalHeapDataParams params;
+    params.iTid = aTid;
+    params.iRHeapVTable = RHeapVTable();
+    params.iDebugAllocator = DebugEUser();
+    params.iDes = &aDest;
+    params.iChecksum = 0;
+    params.iRemaining = aAmountRemaining;
+    params.iReadAddress = aReadAddress;
+    aDest.Zero();
+    //
+    TInt r = DoControl( EMemSpyDriverOpCodeHeapKernelDataGetFull, &params, NULL );
+    //
+    if  ( r >= KErrNone )
+        {
+        aDest.SetLength( r );
+        aReadAddress = params.iReadAddress;
+        aAmountRemaining = params.iRemaining;
+        r = KErrNone;
+        }
+    //
+    return r;
+    }
 
 
 
@@ -792,12 +867,19 @@
     params.iRHeapVTable = RHeapVTable();
     params.iDebugAllocator = DebugEUser();
     //
-	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapInit, &params, NULL );
+	const TInt r = DoControl( EMemSpyDriverOpCodeHeapUserWalkInit, &params, NULL );
 	return r;
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::WalkHeapNextCell( TUint aTid, TMemSpyDriverCellType& aCellType, TAny*& aCellAddress, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellHeaderSize, TAny*& aCellPayloadAddress )
+EXPORT_C TInt RMemSpyDriverClient::WalkHeapNextCell(TUint aTid, 
+                                                    TMemSpyDriverCellType& aCellType, 
+                                                    TAny*& aCellAddress, 
+                                                    TInt& aLength, 
+                                                    TInt& aNestingLevel, 
+                                                    TInt& aAllocNumber, 
+                                                    TInt& aCellHeaderSize, 
+                                                    TAny*& aCellPayloadAddress)
     {
     aCellType = EMemSpyDriverBadCellMask;
     aCellAddress = NULL;
@@ -808,7 +890,7 @@
     aCellPayloadAddress = NULL;
     //
     TMemSpyDriverInternalWalkHeapParamsCell params;
-	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapNextCell, (TAny*) aTid, &params );
+	const TInt r = DoControl( EMemSpyDriverOpCodeHeapUserWalkNextCell, (TAny*) aTid, &params );
     //
 	if  ( r == KErrNone )
 	    {
@@ -832,7 +914,7 @@
     params.iDes = &aDest;
     aDest.Zero();
     //
-	TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapReadCellData, &params, NULL );
+	TInt r = DoControl( EMemSpyDriverOpCodeHeapUserWalkReadCellData, &params, NULL );
     if  ( r >= KErrNone )
         {
         aDest.SetLength( r );
@@ -843,7 +925,13 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::WalkHeapGetCellInfo( TAny*& aCellAddress, TMemSpyDriverCellType& aCellType, TInt& aLength, TInt& aNestingLevel, TInt& aAllocNumber, TInt& aCellHeaderSize, TAny*& aCellPayloadAddress )
+EXPORT_C TInt RMemSpyDriverClient::WalkHeapGetCellInfo(TAny*& aCellAddress, 
+                                                       TMemSpyDriverCellType& aCellType, 
+                                                       TInt& aLength, 
+                                                       TInt& aNestingLevel, 
+                                                       TInt& aAllocNumber, 
+                                                       TInt& aCellHeaderSize, 
+                                                       TAny*& aCellPayloadAddress)
     {
     aCellType = EMemSpyDriverBadCellMask;
     aLength = 0;
@@ -853,7 +941,7 @@
     aCellPayloadAddress = NULL;
     //
     TMemSpyDriverInternalWalkHeapParamsCell params;
-	const TInt r = DoControl( EMemSpyDriverOpCodeWalkHeapGetCellInfo, aCellAddress, &params );
+	const TInt r = DoControl( EMemSpyDriverOpCodeHeapUserWalkGetCellInfo, aCellAddress, &params );
     //
 	if  ( r == KErrNone )
 	    {
@@ -871,7 +959,7 @@
 
 EXPORT_C void RMemSpyDriverClient::WalkHeapClose()
     {
-	DoControl( EMemSpyDriverOpCodeWalkHeapClose, NULL, NULL );
+	DoControl( EMemSpyDriverOpCodeHeapUserWalkClose, NULL, NULL );
     }
 
 
@@ -920,7 +1008,11 @@
     }    
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetStackData( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain, TBool aEntireStack )
+EXPORT_C TInt RMemSpyDriverClient::GetStackData(TUint aTid, 
+                                                TDes8& aDest, 
+                                                TUint& aAmountRemaining, 
+                                                TMemSpyDriverDomainType aDomain, 
+                                                TBool aEntireStack)
     {
     TMemSpyDriverInternalStackDataParams params;
     params.iTid = aTid;
@@ -943,7 +1035,11 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetStackDataNext( TUint aTid, TDes8& aDest, TUint& aAmountRemaining, TMemSpyDriverDomainType aDomain, TBool aEntireStack )
+EXPORT_C TInt RMemSpyDriverClient::GetStackDataNext(TUint aTid, 
+                                                    TDes8& aDest, 
+                                                    TUint& aAmountRemaining, 
+                                                    TMemSpyDriverDomainType aDomain, 
+                                                    TBool aEntireStack )
     {
     TMemSpyDriverInternalStackDataParams params;
     params.iTid = aTid;
@@ -1096,7 +1192,9 @@
     }
 
 
-EXPORT_C void RMemSpyDriverClient::ProcessInspectionRequestChanges( TUint aPid, TRequestStatus& aStatus, TMemSpyDriverProcessInspectionInfo& aInfo )
+EXPORT_C void RMemSpyDriverClient::ProcessInspectionRequestChanges(TUint aPid, 
+                                                                   TRequestStatus& aStatus, 
+                                                                   TMemSpyDriverProcessInspectionInfo& aInfo )
     {
     aInfo.iProcessId = aPid;
     aStatus = KRequestPending;
@@ -1150,7 +1248,9 @@
 
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetContainerHandles( TMemSpyDriverContainerType aContainer, TAny** aHandleArray, TInt& aHandleCount )
+EXPORT_C TInt RMemSpyDriverClient::GetContainerHandles(TMemSpyDriverContainerType aContainer, 
+                                                       TAny** aHandleArray, 
+                                                       TInt& aHandleCount)
     {
 	TMemSpyDriverInternalContainerHandleParams params;
 	params.iTidOrPid = KMemSpyDriverEnumerateContainerHandles;
@@ -1166,7 +1266,10 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetThreadHandlesByType( TInt aTid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount )
+EXPORT_C TInt RMemSpyDriverClient::GetThreadHandlesByType(TInt aTid, 
+                                                          TMemSpyDriverContainerType aType, 
+                                                          TAny** aHandleArray, 
+                                                          TInt& aHandleCount)
     {
 	TMemSpyDriverInternalContainerHandleParams params;
 	params.iTidOrPid = aTid;
@@ -1182,7 +1285,10 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetProcessHandlesByType( TInt aPid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount )
+EXPORT_C TInt RMemSpyDriverClient::GetProcessHandlesByType(TInt aPid, 
+                                                           TMemSpyDriverContainerType aType, 
+                                                           TAny** aHandleArray, 
+                                                           TInt& aHandleCount)
     {
 	TMemSpyDriverInternalContainerHandleParams params;
 	params.iTidOrPid = aPid;
@@ -1198,7 +1304,10 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetGenericHandleInfo( TInt aTid, TMemSpyDriverContainerType aType, TAny* aHandle, TMemSpyDriverHandleInfoGeneric& aParams )
+EXPORT_C TInt RMemSpyDriverClient::GetGenericHandleInfo(TInt aTid, 
+                                                        TMemSpyDriverContainerType aType, 
+                                                        TAny* aHandle, 
+                                                        TMemSpyDriverHandleInfoGeneric& aParams)
     {
     aParams.iType = aType;
     aParams.iHandle = aHandle;
@@ -1239,7 +1348,9 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreads( TAny* aCondVarHandle, TAny** aThreadHandleArray, TInt& aThreadCount )
+EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreads(TAny* aCondVarHandle, 
+                                                              TAny** aThreadHandleArray, 
+                                                              TInt& aThreadCount)
     {
     TMemSpyDriverInternalCondVarSuspendedThreadParams params;
     params.iCondVarHandle = aCondVarHandle;
@@ -1253,7 +1364,8 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreadInfo( TAny* aHandle, TMemSpyDriverCondVarSuspendedThreadInfo& aParams )
+EXPORT_C TInt RMemSpyDriverClient::GetCondVarSuspendedThreadInfo(TAny* aHandle, 
+                                                                 TMemSpyDriverCondVarSuspendedThreadInfo& aParams)
     {
     return DoControl( EMemSpyDriverOpCodeContainersGetCondVarSuspendedThreadInfo, aHandle, &aParams );
     }
@@ -1274,7 +1386,9 @@
 
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetServerSessionHandles( TAny* aServerHandle, TAny** aSessionHandleArray, TInt& aSessionHandleCount )
+EXPORT_C TInt RMemSpyDriverClient::GetServerSessionHandles(TAny* aServerHandle, 
+                                                           TAny** aSessionHandleArray, 
+                                                           TInt& aSessionHandleCount)
     {
 	TMemSpyDriverInternalServerSessionHandleParams params;
 	params.iServerHandle = aServerHandle;
@@ -1288,7 +1402,8 @@
     }
 
 
-EXPORT_C TInt RMemSpyDriverClient::GetServerSessionInfo( TAny* aSessionHandle, TMemSpyDriverServerSessionInfo& aParams )
+EXPORT_C TInt RMemSpyDriverClient::GetServerSessionInfo(TAny* aSessionHandle, 
+                                                        TMemSpyDriverServerSessionInfo& aParams)
     {
     return DoControl( EMemSpyDriverOpCodeClientServerGetServerSessionInfo, aSessionHandle, &aParams );
     }
@@ -1452,6 +1567,10 @@
         CleanupStack::PopAndDestroy( &stream );
         }
 
+#ifdef _DEBUG
+        RDebug::Printf( "[MemSpy] RMemSpyDriverClient::ReadHeapInfoFreeCellsFromXferBufferL() - END" );
+#endif
+
     ResetStreamBuffer();
     }
 
--- a/perfsrv/memspy/Driver/eabi/memspydriverclientu.def	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/eabi/memspydriverclientu.def	Mon Oct 04 02:45:59 2010 +0300
@@ -35,7 +35,7 @@
 	_ZN19RMemSpyDriverClient17GetHeapInfoKernelER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellE @ 34 NONAME
 	_ZN19RMemSpyDriverClient18EventMonitorNotifyEjR14TRequestStatusRj @ 35 NONAME
 	_ZN19RMemSpyDriverClient19GetContainerHandlesE26TMemSpyDriverContainerTypePPvRi @ 36 NONAME
-	_ZN19RMemSpyDriverClient19GetHeapDataKernelLCER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellE @ 37 NONAME
+	_ZN19RMemSpyDriverClient19GetHeapDataKernelLCER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellE @ 37 NONAME ABSENT
 	_ZN19RMemSpyDriverClient19WalkHeapGetCellInfoERPvR21TMemSpyDriverCellTypeRiS4_S4_S4_S1_ @ 38 NONAME
 	_ZN19RMemSpyDriverClient20GetGenericHandleInfoEi26TMemSpyDriverContainerTypePvR30TMemSpyDriverHandleInfoGeneric @ 39 NONAME
 	_ZN19RMemSpyDriverClient20GetServerSessionInfoEPvR30TMemSpyDriverServerSessionInfo @ 40 NONAME
@@ -68,4 +68,10 @@
 	_ZN19RMemSpyDriverClient26GetCondVarSuspendedThreadsEPvPS0_Ri @ 67 NONAME
 	_ZN19RMemSpyDriverClient29GetCondVarSuspendedThreadInfoEPvR39TMemSpyDriverCondVarSuspendedThreadInfo @ 68 NONAME
 	_ZN19RMemSpyDriverClient15GetHeapInfoUserER15TMemSpyHeapInfojR6RArrayI21TMemSpyDriverFreeCellEi @ 69 NONAME
+	_ZN19RMemSpyDriverClient17GetHeapDataKernelEjR5TDes8RjS2_ @ 70 NONAME
+	_ZN19RMemSpyDriverClient17GetHeapInfoKernelER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellEi @ 71 NONAME
+	_ZN19RMemSpyDriverClient17GetHeapInfoKernelER15TMemSpyHeapInfoR6RArrayI21TMemSpyDriverFreeCellEii @ 72 NONAME
+	_ZN19RMemSpyDriverClient18CopyHeapDataKernelEv @ 73 NONAME
+	_ZN19RMemSpyDriverClient18FreeHeapDataKernelEv @ 74 NONAME
+	_ZN19RMemSpyDriverClient21GetHeapDataKernelNextEjR5TDes8RjS2_ @ 75 NONAME
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/Driver/eabi/memspydriveru.def	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z19CreateLogicalDevicev @ 1 NONAME
+
--- a/perfsrv/memspy/Driver/group/MemSpyDriver.mmp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/group/MemSpyDriver.mmp	Mon Oct 04 02:45:59 2010 +0300
@@ -25,6 +25,8 @@
 VENDORID        VID_DEFAULT
 SMPSAFE
 
+NOEXPORTLIBRARY
+
 CAPABILITY      all
 
 SOURCEPATH      ../Kernel/Source
@@ -54,9 +56,10 @@
 SOURCE          MemSpyDriverLogChanContainers.cpp
 SOURCE          MemSpyDriverLogChanContainerBase.cpp
 SOURCE          MemSpyDriverLogChanHeapBase.cpp
-SOURCE          MemSpyDriverLogChanHeapData.cpp
-SOURCE          MemSpyDriverLogChanHeapWalk.cpp
-SOURCE          MemSpyDriverLogChanHeapInfo.cpp
+SOURCE          MemSpyDriverLogChanHeapDataBase.cpp
+SOURCE          MemSpyDriverLogChanHeapDataUser.cpp
+SOURCE          MemSpyDriverLogChanHeapDataKernel.cpp 
+SOURCE          MemSpyDriverLogChanHeapWalkUser.cpp 
 SOURCE          MemSpyDriverLogChanMisc.cpp
 SOURCE          MemSpyDriverLogChanProcessInspection.cpp
 SOURCE          MemSpyDriverLogChanStack.cpp
@@ -83,9 +86,9 @@
 MACRO           MCL_FIND_HANDLES
 
 #if (SYMBIAN_VERSION_SUPPORT >= SYMBIAN_3) || defined(BSW_FLEXIBLE_MEMORY_MODEL)
-    MACRO       MCL_ROBJECTIX_DUPLICATION
+MACRO       MCL_ROBJECTIX_DUPLICATION
 #else
-    MACRO       MCL_DOBJECTIX_DUPLICATION
+MACRO       MCL_DOBJECTIX_DUPLICATION
 #endif
 
 #include <kernel/kern_ext.mmh>
--- a/perfsrv/memspy/Engine/BWINS/MemSpyEngineu.def	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Engine/BWINS/MemSpyEngineu.def	Mon Oct 04 02:45:59 2010 +0300
@@ -424,4 +424,5 @@
 	?InstallFileSinkL@CMemSpyEngine@@QAEXABVTDesC16@@@Z @ 423 NONAME ; void CMemSpyEngine::InstallFileSinkL(class TDesC16 const &)
 	?CheckForChangesNowL@CMemSpyEngineHelperSysMemTracker@@QAEXXZ @ 424 NONAME ; void CMemSpyEngineHelperSysMemTracker::CheckForChangesNowL(void)
 	?GetHeapInfoUserL@CMemSpyEngineHelperHeap@@QAEXABVTProcessId@@ABVTThreadId@@AAVTMemSpyHeapInfo@@PAV?$RArray@VTMemSpyDriverFreeCell@@@@H@Z @ 425 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoUserL(class TProcessId const &, class TThreadId const &, class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> *, int)
+	?GetHeapInfoKernelL@CMemSpyEngineHelperHeap@@QAEXAAVTMemSpyHeapInfo@@PAV?$RArray@VTMemSpyDriverFreeCell@@@@H@Z @ 426 NONAME ; void CMemSpyEngineHelperHeap::GetHeapInfoKernelL(class TMemSpyHeapInfo &, class RArray<class TMemSpyDriverFreeCell> *, int)
 
--- a/perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -20,8 +20,7 @@
 // System includes
 #include <e32svr.h>
 #include <w32std.h>
-#include <APGTASK.H>
-#include <APGWGNAM.H>  
+//#include <coedef.h>  
 
 // User includes
 #include <memspy/engine/memspyengine.h>
@@ -556,8 +555,9 @@
 			RArray<RWsSession::TWindowGroupChainInfo> wgArray;
 			CleanupClosePushL( wgArray );
 			User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) );
-			TApaTask task( wsSession );
-			TBool brought( EFalse );
+						
+			//TApaTask task( wsSession );
+			TBool brought = EFalse;
 			TInt wgId( KErrNotFound );
 			TThreadId threadId;
 					
@@ -571,16 +571,27 @@
 				User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) );
 				if ( threadId == id() )
 					{
-					CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId );
-					task.SetWgId( wgId );
-					if ( !wgName->Hidden() && task.Exists() )
+					TInt handle = wsSession.GetWindowGroupHandle( wgId );
+					if( handle == KErrNone )
 						{
-						task.BringToForeground();
-						brought = ETrue;                        
+						RWindowGroup* group = new (ELeave) RWindowGroup();
+						group->Construct( handle );        
+						group->SetOrdinalPosition( 0 ); //foreground
+						
+						brought = ETrue;
+						
+						group->Close();
+						delete group;												
 						}
-					CleanupStack::PopAndDestroy( wgName );
+					}					    					    					    										    										
+					//task.SetWgId( wgId );
+					//if ( !wgName->Hidden() && task.Exists() )
+					//	{
+					//	task.BringToForeground();
+					//	brought = ETrue;                        
+					//	}					
 					}
-				}			
+													
 			TPckgBuf<TBool> ret( brought );
 			aMessage.WriteL( 1, ret );															
 					
@@ -892,7 +903,8 @@
                 TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread );
                 if (error == KErrNone && thread)
                     {
-                    data.iId = thread->Process().Id();
+                    data.iProcessId = thread->Process().Id();
+                    data.iThreadId = thread->Id();
                     }
                 data.iName.Copy(server.Name().Left(KMaxFullName));
                 data.iSessionCount = server.SessionCount();
@@ -933,7 +945,14 @@
 				const CMemSpyEngineServerEntry& server = list->At(i);
 				TMemSpyServerData data;
         	                
-				data.iId = server.Id();
+				CMemSpyProcess* process = NULL;
+                CMemSpyThread* thread = NULL;
+                TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread );
+                if (error == KErrNone && thread)
+                    {
+                    data.iProcessId = thread->Process().Id();
+                    data.iThreadId = thread->Id();
+                    }
 				data.iName.Copy(server.Name().Left(KMaxFullName));
 				data.iSessionCount = server.SessionCount();
         	                
@@ -1227,6 +1246,59 @@
         break;
 	    }
 	    
+	case EMemSpyClientServerOpGetWindowGroupCount:
+	    {
+	    if (!iEngine.IsHelperWindowServerSupported())
+	        {
+	        User::Leave(KErrNotSupported);
+	        }
+	    
+	    RWsSession windowSession;
+	    windowSession.Connect();
+	    TInt result = windowSession.NumWindowGroups();
+	    windowSession.Close();
+	    User::LeaveIfError(result);
+	    
+	    aMessage.WriteL(0, TPckgBuf<TInt>(result));
+	    break;
+	    }
+        
+	case EMemSpyClientServerOpGetWindowGroups:
+	    {
+	    if (!iEngine.IsHelperWindowServerSupported())
+            {
+            User::Leave(KErrNotSupported);
+            }
+	    
+	    RArray<TMemSpyEngineWindowGroupBasicInfo> groups;
+	    CleanupClosePushL( groups );
+	    
+	    iEngine.HelperWindowServer().GetWindowGroupListL( groups );
+        
+        TPckgBuf<TInt> a0;
+        aMessage.ReadL(0, a0);
+        TInt realCount = Min(a0(), groups.Count());
+                        
+        for (TInt i=0, offset = 0; i<realCount; i++, offset += sizeof(TMemSpyEngineWindowGroupDetails))
+            {
+            TMemSpyEngineWindowGroupDetails data;
+            
+            
+            iEngine.HelperWindowServer().GetWindowGroupDetailsL(groups[i].iId, data);
+            
+            TPckgBuf<TMemSpyEngineWindowGroupDetails> buffer(data);
+            aMessage.WriteL(1, buffer, offset);
+            }
+        
+        a0 = realCount;
+        aMessage.WriteL(0, a0);
+        
+        CleanupStack::PopAndDestroy( &groups ); 
+        
+	    break;
+	    }
+	    
+	    
 		}
     }
 
--- a/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperHeap.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Engine/Source/Helpers/MemSpyEngineHelperHeap.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -267,12 +267,21 @@
     }
 
 
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapDataUserL(const TProcessId& aPid, const TThreadId& aTid, const TDesC& aThreadName, const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverCell>* aCells)
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapDataUserL(const TProcessId& aPid, 
+                                                           const TThreadId& aTid, 
+                                                           const TDesC& aThreadName, 
+                                                           const TMemSpyHeapInfo& aInfo, 
+                                                           const RArray<TMemSpyDriverCell>* aCells)
     {
     OutputHeapDataUserL(aPid, aTid, aThreadName, aInfo, ETrue, aCells);
     }
 
-void CMemSpyEngineHelperHeap::OutputHeapDataUserL( const TProcessId& aPid, const TThreadId& aTid, const TDesC& aThreadName, const TMemSpyHeapInfo& aInfo, TBool aCreateDataStream, const RArray<TMemSpyDriverCell>* aCells )
+void CMemSpyEngineHelperHeap::OutputHeapDataUserL(const TProcessId& aPid, 
+                                                  const TThreadId& aTid, 
+                                                  const TDesC& aThreadName, 
+                                                  const TMemSpyHeapInfo& aInfo, 
+                                                  TBool aCreateDataStream, 
+                                                  const RArray<TMemSpyDriverCell>* aCells )
     {
     TBuf<KMaxFullName + 100> printFormat;
 
@@ -383,7 +392,9 @@
 
 
 
-EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoL( const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const RArray<TMemSpyDriverCell>* aCells )
+EXPORT_C void CMemSpyEngineHelperHeap::OutputHeapInfoL(const TMemSpyHeapInfo& aInfo, 
+                                                       const TDesC& aThreadName, 
+                                                       const RArray<TMemSpyDriverCell>* aCells )
 	{
     CMemSpyEngineOutputList* list = NewHeapSummaryExtendedLC(aInfo, aCells);
 
@@ -428,7 +439,10 @@
 
 
 
-void CMemSpyEngineHelperHeap::OutputCSVEntryL( TInt aIndex, const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const TDesC& aProcessName )
+void CMemSpyEngineHelperHeap::OutputCSVEntryL(TInt aIndex, 
+                                              const TMemSpyHeapInfo& aInfo, 
+                                              const TDesC& aThreadName, 
+                                              const TDesC& aProcessName )
     {
     const TMemSpyHeapInfoRHeap& rHeapInfo = aInfo.AsRHeap();
     const TMemSpyHeapMetaDataRHeap& rHeapMetaData = rHeapInfo.MetaData();
@@ -592,12 +606,19 @@
 
 
 
-EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL(const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells)
+EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL(const TProcessId& aProcess, 
+                                                        const TThreadId& aThread, 
+                                                        TMemSpyHeapInfo& aInfo, 
+                                                        RArray<TMemSpyDriverFreeCell>* aFreeCells)
     {
 	GetHeapInfoUserL(aProcess, aThread, aInfo, aFreeCells, EFalse);
 	}
 
-EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL(const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverCell>* aCells, TBool aCollectAllocatedCellsAsWellAsFree)
+EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL(const TProcessId& aProcess, 
+                                                        const TThreadId& aThread, 
+                                                        TMemSpyHeapInfo& aInfo, 
+                                                        RArray<TMemSpyDriverCell>* aCells, 
+                                                        TBool aCollectAllocatedCellsAsWellAsFree)
     {
     iEngine.ProcessSuspendLC( aProcess );
     TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::GetHeapInfoUserL() - checksum1: 0x%08x", aInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
@@ -624,7 +645,8 @@
     }
 
 
-EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL( const CMemSpyProcess& aProcess, RArray<TMemSpyHeapInfo >& aInfos )
+EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoUserL(const CMemSpyProcess& aProcess, 
+                                                        RArray<TMemSpyHeapInfo >& aInfos)
     {
     aInfos.Reset();
     iEngine.ProcessSuspendLC( aProcess.Id() );
@@ -673,14 +695,32 @@
 
 
 
+EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, 
+                                                           RArray<TMemSpyDriverFreeCell>* aFreeCells )
+    {
+    GetHeapInfoKernelL(aInfo, aFreeCells, EFalse, EFalse);
+    }
 
-EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells )
+EXPORT_C void CMemSpyEngineHelperHeap::GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, 
+                                                           RArray<TMemSpyDriverFreeCell>* aFreeCells, 
+                                                           TBool aCollectAllocatedCellsAsWellAsFree )
+    {
+    GetHeapInfoKernelL(aInfo, aFreeCells, aCollectAllocatedCellsAsWellAsFree, EFalse);
+    }
+
+void CMemSpyEngineHelperHeap::GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, 
+                                                  RArray<TMemSpyDriverFreeCell>* aFreeCells, 
+                                                  TBool aCollectAllocatedCellsAsWellAsFree, 
+                                                  TBool aUseKernelCopy )
     {
     TInt error = KErrNone;
     //
     if  ( aFreeCells )
         {
-        error = iEngine.Driver().GetHeapInfoKernel( aInfo, *aFreeCells );
+        error = iEngine.Driver().GetHeapInfoKernel( aInfo, 
+                                                    *aFreeCells, 
+                                                    aCollectAllocatedCellsAsWellAsFree, 
+                                                    aUseKernelCopy );
         }
     else
         {
@@ -718,9 +758,43 @@
     }
 
 
+void CMemSpyEngineHelperHeap::CleanupHeapDataKernel( TAny* aPtr )
+    {
+    if ( aPtr )
+        {
+        CMemSpyEngineHelperHeap* ptr = static_cast<CMemSpyEngineHelperHeap*>( aPtr );
+        (void) ptr->iEngine.Driver().FreeHeapDataKernel();
+        }
+    }
+
 void CMemSpyEngineHelperHeap::OutputHeapDataKernelL( TBool aCreateDataStream )
     {
-    // Get thread name
+    User::LeaveIfError(iEngine.Driver().CopyHeapDataKernel());
+    TCleanupItem item = TCleanupItem(CleanupHeapDataKernel, this);
+    CleanupStack::PushL(item);
+    
+    // Get the heap info, including cell information
+    RArray<TMemSpyDriverCell> cells;
+    CleanupClosePushL( cells );
+    
+    TMemSpyHeapInfo heapInfo;
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataKernelL() - checksum before: 0x%08x", 
+                           heapInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
+    GetHeapInfoKernelL(heapInfo, &cells, ETrue, ETrue);
+    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataKernelL() - checksum after: 0x%08x", 
+                           heapInfo.AsRHeap().Statistics().StatsFree().Checksum() ) );
+
+    // Output the heap data
+    OutputHeapDataKernelL( heapInfo, aCreateDataStream, &cells );
+    
+    CleanupStack::PopAndDestroy( &cells );
+    CleanupStack::PopAndDestroy( this );
+    }    
+
+void CMemSpyEngineHelperHeap::OutputHeapDataKernelL(const TMemSpyHeapInfo& aHeapInfo, 
+                                                    TBool aCreateDataStream, 
+                                                    const RArray<TMemSpyDriverCell>* aCells)
+    {
     TFullName threadName;
     MemSpyEngineUtils::GetKernelHeapThreadName( threadName, EFalse );
 
@@ -736,38 +810,66 @@
         CleanupStack::PopAndDestroy( context );
         }
 
-    RArray<TMemSpyDriverFreeCell> freeCells;
-    CleanupClosePushL( freeCells );
-
-    // Get kernel data and heap info before outputting anything...
-    TMemSpyHeapInfo info;
-    HBufC8* data = iEngine.Driver().GetHeapDataKernelLC( info, freeCells );
+    TBuf<KMaxFullName + 100> printFormat;
 
     // Start marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, info.Tid() );
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, aHeapInfo.Tid() );
 
     // Set overall prefix
     iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixHeapData, &threadName );
 
     // Info section
-    OutputHeapInfoL( info, threadName, &freeCells );
+    OutputHeapInfoL( aHeapInfo, threadName, aCells );
+
+    // Code segments (needed for map file reading...)
+    _LIT(KCellListCodeSegInfoFormat, "CodeSegs - ");
+    iEngine.HelperCodeSegment().OutputCodeSegmentsL( aHeapInfo.Pid(), printFormat, KCellListCodeSegInfoFormat, '-', ETrue );
 
     // Dump section
     _LIT(KHeaderDump, "Heap Data");
     iEngine.Sink().OutputSectionHeadingL( KHeaderDump, '-' );
 
-    /*TOMSCI TODO this stuff needs fixing
-	_LIT(KHeapDumpDataFormat, "%S");
-    const TUint8* heapBaseAddress = info.AsRHeap().ObjectData().Base();
-    iEngine.Sink().OutputBinaryDataL( KHeapDumpDataFormat, data->Ptr(), heapBaseAddress, data->Length() );
-	*/
+    HBufC8* data = HBufC8::NewLC( 4096 * 12 );
+    TPtr8 pData(data->Des());
+    TUint remaining = 0;
+    TUint readAddress = 0;
+
+    TInt r = iEngine.Driver().GetHeapDataKernel(aHeapInfo.Tid(), pData, readAddress, remaining);
+    TUint prevEndAddress = readAddress + pData.Length();
+    if (r == KErrNone)
+        {
+        while (r == KErrNone)
+            {
+            if (readAddress > prevEndAddress)
+                {
+                // We've hit a discontinuity, ie one or more unmapped pages
+                _LIT(KBreak, "........");
+                iEngine.Sink().OutputLineL(KBreak);
+                }
+            _LIT(KHeapDumpDataFormat, "%S");
+            iEngine.Sink().OutputBinaryDataL(KHeapDumpDataFormat, pData.Ptr(), (const TUint8*) readAddress, pData.Length());
+            readAddress += pData.Length();
+            if (remaining > 0)
+                {
+                prevEndAddress = readAddress;
+                r = iEngine.Driver().GetHeapDataKernelNext(aHeapInfo.Tid(), pData, readAddress, remaining);
+                }
+            else
+                break;
+            }
+        }
+    else
+        {
+        _LIT( KHeapFetchError, "Heap error: %d");
+        iEngine.Sink().OutputLineFormattedL( KHeapFetchError, r );
+        }
+
+    CleanupStack::PopAndDestroy( data );
 
     CleanupStack::PopAndDestroy(); // clear prefix
-    CleanupStack::PopAndDestroy( data );
-    CleanupStack::PopAndDestroy( &freeCells );
 
     // End marker
-    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, info.Tid() );
+    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, aHeapInfo.Tid() );
 
     if  ( aCreateDataStream )
         {
@@ -898,7 +1000,8 @@
     }
 
 
-EXPORT_C CMemSpyEngineOutputList* CMemSpyEngineHelperHeap::NewHeapSummaryExtendedLC( const TMemSpyHeapInfo& aInfo, const RArray<TMemSpyDriverCell>* aCells )
+EXPORT_C CMemSpyEngineOutputList* CMemSpyEngineHelperHeap::NewHeapSummaryExtendedLC( const TMemSpyHeapInfo& aInfo, 
+                                                                                     const RArray<TMemSpyDriverCell>* aCells )
 	{
     CMemSpyEngineOutputList* list = CMemSpyEngineOutputList::NewLC( iEngine.Sink() );
     //
@@ -1180,7 +1283,9 @@
 		}
     }
 
-void CMemSpyEngineHelperHeap::UpdateSharedHeapInfoL( const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo )
+void CMemSpyEngineHelperHeap::UpdateSharedHeapInfoL( const TProcessId& aProcess, 
+                                                     const TThreadId& aThread, 
+                                                     TMemSpyHeapInfo& aInfo )
     {
     RArray<TThreadId> threads;
     CleanupClosePushL( threads );
--- a/perfsrv/memspy/Engine/eabi/MemSpyEngineu.def	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Engine/eabi/MemSpyEngineu.def	Mon Oct 04 02:45:59 2010 +0300
@@ -553,4 +553,5 @@
 	_ZN25CMemSpyEngineSinkMetaData4NewLERK7TDesC16S2_S2_S2_iiRK5TTime @ 552 NONAME
 	_ZN32CMemSpyEngineHelperSysMemTracker19CheckForChangesNowLEv @ 553 NONAME
 	_ZN23CMemSpyEngineHelperHeap16GetHeapInfoUserLERK10TProcessIdRK9TThreadIdR15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellEi @ 554 NONAME
+	_ZN23CMemSpyEngineHelperHeap18GetHeapInfoKernelLER15TMemSpyHeapInfoP6RArrayI21TMemSpyDriverFreeCellEi @ 555 NONAME
 
--- a/perfsrv/memspy/Engine/group/MemSpyEngine.mmp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Engine/group/MemSpyEngine.mmp	Mon Oct 04 02:45:59 2010 +0300
@@ -113,7 +113,6 @@
 
 OS_LAYER_SYSTEMINCLUDE
 
-APP_LAYER_SYSTEMINCLUDE
 
 LIBRARY			euser.lib 
 LIBRARY			MemSpyDriverClient.lib hal.lib estor.lib
--- a/perfsrv/memspy/MemSpyClient/bwins/MemSpyClientu.def	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/bwins/MemSpyClientu.def	Mon Oct 04 02:45:59 2010 +0300
@@ -9,213 +9,230 @@
 	?OutputHeapData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 8 NONAME ; void RMemSpySession::OutputHeapData(class TRequestStatus &)
 	?GetSwmtCategoriesL@RMemSpySession@@QAEXAAH@Z @ 9 NONAME ; void RMemSpySession::GetSwmtCategoriesL(int &)
 	?SessionType@CMemSpyApiKernelObjectItem@@QBE?AW4TIpcSessionType@@XZ @ 10 NONAME ; enum TIpcSessionType CMemSpyApiKernelObjectItem::SessionType(void) const
-	?VID@CMemSpyApiThread@@QBEHXZ @ 11 NONAME ; int CMemSpyApiThread::VID(void) const
-	?OutputStackInfoL@RMemSpySession@@QAEXVTThreadId@@@Z @ 12 NONAME ; void RMemSpySession::OutputStackInfoL(class TThreadId)
-	?FreeMemory@CMemSpyApiMemoryTrackingCycle@@QBEAB_JXZ @ 13 NONAME ; long long const & CMemSpyApiMemoryTrackingCycle::FreeMemory(void) const
-	?ProcessNumberUsing@CMemSpyApiThread@@QBEHXZ @ 14 NONAME ; int CMemSpyApiThread::ProcessNumberUsing(void) const
-	?PreviousCycleDiff@CMemSpyApiMemoryTrackingCycle@@QBE_JXZ @ 15 NONAME ; long long CMemSpyApiMemoryTrackingCycle::PreviousCycleDiff(void) const
-	?OutputStackDataL@RMemSpySession@@QAEXVTThreadId@@W4TMemSpyDriverDomainType@@@Z @ 16 NONAME ; void RMemSpySession::OutputStackDataL(class TThreadId, enum TMemSpyDriverDomainType)
-	?OutputThreadHeapDataL@RMemSpySession@@QAEXVTThreadId@@@Z @ 17 NONAME ; void RMemSpySession::OutputThreadHeapDataL(class TThreadId)
-	?ExitType@CMemSpyApiProcess@@QBE?AW4TExitType@@XZ @ 18 NONAME ; enum TExitType CMemSpyApiProcess::ExitType(void) const
-	?SwitchOutputToFileL@RMemSpySession@@QAEXABVTDesC16@@@Z @ 19 NONAME ; void RMemSpySession::SwitchOutputToFileL(class TDesC16 const &)
-	?OutputHeapCellListing@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 20 NONAME ; void RMemSpySession::OutputHeapCellListing(class TRequestStatus &)
-	?SetThreadPriorityL@RMemSpySession@@QAEXVTThreadId@@H@Z @ 21 NONAME ; void RMemSpySession::SetThreadPriorityL(class TThreadId, int)
-	?Restrictions@CMemSpyApiKernelObjectItem@@QBEIXZ @ 22 NONAME ; unsigned int CMemSpyApiKernelObjectItem::Restrictions(void) const
-	?Id@CMemSpyApiKernelObjectItem@@QBEHXZ @ 23 NONAME ; int CMemSpyApiKernelObjectItem::Id(void) const
-	?Count@CMemSpyApiKernelObjectItem@@QBEHXZ @ 24 NONAME ; int CMemSpyApiKernelObjectItem::Count(void) const
-	?ControllingOwner@CMemSpyApiKernelObjectItem@@QBEIXZ @ 25 NONAME ; unsigned int CMemSpyApiKernelObjectItem::ControllingOwner(void) const
-	?SwmtResetTracking@RMemSpySession@@QAEXXZ @ 26 NONAME ; void RMemSpySession::SwmtResetTracking(void)
-	?Version@CMemSpyApiKernelObjectItem@@QBE?AVTVersion@@XZ @ 27 NONAME ; class TVersion CMemSpyApiKernelObjectItem::Version(void) const
-	?SwitchToProcess@RMemSpySession@@QAEHVTProcessId@@H@Z @ 28 NONAME ; int RMemSpySession::SwitchToProcess(class TProcessId, int)
-	?MaxSize@CMemSpyApiKernelObjectItem@@QBEHXZ @ 29 NONAME ; int CMemSpyApiKernelObjectItem::MaxSize(void) const
-	?IsSwmtRunningL@RMemSpySession@@QAEHXZ @ 30 NONAME ; int RMemSpySession::IsSwmtRunningL(void)
-	?AddressOfOwningProcess@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 31 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfOwningProcess(void)
-	?ExitReason@CMemSpyApiProcess@@QBEHXZ @ 32 NONAME ; int CMemSpyApiProcess::ExitReason(void) const
-	?MsgCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 33 NONAME ; int CMemSpyApiKernelObjectItem::MsgCount(void) const
-	?AllocationsCount@CMemSpyApiHeap@@QAEHXZ @ 34 NONAME ; int CMemSpyApiHeap::AllocationsCount(void)
-	?WaitCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 35 NONAME ; int CMemSpyApiKernelObjectItem::WaitCount(void) const
-	?SID@CMemSpyApiProcess@@QBEKXZ @ 36 NONAME ; unsigned long CMemSpyApiProcess::SID(void) const
-	?GetKernelObjectsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiKernelObject@@@@@Z @ 37 NONAME ; void RMemSpySession::GetKernelObjectsL(class RArray<class CMemSpyApiKernelObject *> &)
-	?CycleNumber@CMemSpyApiMemoryTrackingCycle@@QBEHXZ @ 38 NONAME ; int CMemSpyApiMemoryTrackingCycle::CycleNumber(void) const
-	?Size@CMemSpyApiKernelObject@@QBE_JXZ @ 39 NONAME ; long long CMemSpyApiKernelObject::Size(void) const
-	?SetSwmtCategoriesL@RMemSpySession@@QAEXH@Z @ 40 NONAME ; void RMemSpySession::SetSwmtCategoriesL(int)
-	?CancelDeviceWideOperationL@RMemSpySession@@QAEXXZ @ 41 NONAME ; void RMemSpySession::CancelDeviceWideOperationL(void)
-	?TotalAllocations@CMemSpyApiHeap@@QAEHXZ @ 42 NONAME ; int CMemSpyApiHeap::TotalAllocations(void)
-	?Name@CMemSpyApiProcess@@QBEABVTDesC16@@XZ @ 43 NONAME ; class TDesC16 const & CMemSpyApiProcess::Name(void) const
-	?DumpKernelHeap@RMemSpySession@@QAEXXZ @ 44 NONAME ; void RMemSpySession::DumpKernelHeap(void)
-	?GetKernelObjects@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiKernelObject@@@@@Z @ 45 NONAME ; int RMemSpySession::GetKernelObjects(class RArray<class CMemSpyApiKernelObject *> &)
-	?Priority@CMemSpyApiProcess@@QBE?AW4TProcessPriority@@XZ @ 46 NONAME ; enum TProcessPriority CMemSpyApiProcess::Priority(void) const
-	?HeaderSizeF@CMemSpyApiHeap@@QAEHXZ @ 47 NONAME ; int CMemSpyApiHeap::HeaderSizeF(void)
-	?OutputCompactStackInfoL@RMemSpySession@@QAEXXZ @ 48 NONAME ; void RMemSpySession::OutputCompactStackInfoL(void)
-	?MsgLimit@CMemSpyApiKernelObjectItem@@QBEHXZ @ 49 NONAME ; int CMemSpyApiKernelObjectItem::MsgLimit(void) const
-	?AddressOfDataBssStackChunk@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 50 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfDataBssStackChunk(void)
-	?Top@CMemSpyApiKernelObjectItem@@QBEHXZ @ 51 NONAME ; int CMemSpyApiKernelObjectItem::Top(void) const
-	?Resetting@CMemSpyApiKernelObjectItem@@QBEEXZ @ 52 NONAME ; unsigned char CMemSpyApiKernelObjectItem::Resetting(void) const
-	?GetProcessIdByThreadId@RMemSpySession@@QAEXAAVTProcessId@@VTThreadId@@@Z @ 53 NONAME ; void RMemSpySession::GetProcessIdByThreadId(class TProcessId &, class TThreadId)
-	?HeaderSizeA@CMemSpyApiHeap@@QAEHXZ @ 54 NONAME ; int CMemSpyApiHeap::HeaderSizeA(void)
-	?OutputHeapData@RMemSpySession@@QAEXXZ @ 55 NONAME ; void RMemSpySession::OutputHeapData(void)
-	?TotalAccessCount@CMemSpyApiKernelObjectItem@@QBEGXZ @ 56 NONAME ; unsigned short CMemSpyApiKernelObjectItem::TotalAccessCount(void) const
-	?Changes@CMemSpyApiKernelObjectItem@@QBEIXZ @ 57 NONAME ; unsigned int CMemSpyApiKernelObjectItem::Changes(void) const
-	??0RMemSpySession@@QAE@XZ @ 58 NONAME ; RMemSpySession::RMemSpySession(void)
-	?OutputUserStackData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 59 NONAME ; void RMemSpySession::OutputUserStackData(class TRequestStatus &)
-	?AddressOfServer@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 60 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfServer(void)
-	?Size@CMemSpyApiHeap@@QAEHXZ @ 61 NONAME ; int CMemSpyApiHeap::Size(void)
-	?GetServersL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiServer@@@@@Z @ 62 NONAME ; void RMemSpySession::GetServersL(class RArray<class CMemSpyApiServer *> &)
-	??1CMemSpyApiKernelObject@@QAE@XZ @ 63 NONAME ; CMemSpyApiKernelObject::~CMemSpyApiKernelObject(void)
-	?GetInfoItemType@RMemSpySession@@QAEHHVTThreadId@@AAW4TMemSpyThreadInfoItemType@@@Z @ 64 NONAME ; int RMemSpySession::GetInfoItemType(int, class TThreadId, enum TMemSpyThreadInfoItemType &)
-	??1CMemSpyApiHeap@@QAE@XZ @ 65 NONAME ; CMemSpyApiHeap::~CMemSpyApiHeap(void)
-	?SetSwmtHeapDumpsEnabledL@RMemSpySession@@QAEXH@Z @ 66 NONAME ; void RMemSpySession::SetSwmtHeapDumpsEnabledL(int)
-	?SetSwmtFilter@RMemSpySession@@QAEXABVTDesC16@@@Z @ 67 NONAME ; void RMemSpySession::SetSwmtFilter(class TDesC16 const &)
-	?Size@CMemSpyApiKernelObjectItem@@QBEKXZ @ 68 NONAME ; unsigned long CMemSpyApiKernelObjectItem::Size(void) const
-	?OutputThreadInfoHandlesL@RMemSpySession@@QAEXVTThreadId@@@Z @ 69 NONAME ; void RMemSpySession::OutputThreadInfoHandlesL(class TThreadId)
-	?OutputThreadHeapDataL@RMemSpySession@@QAEXABVTDesC16@@@Z @ 70 NONAME ; void RMemSpySession::OutputThreadHeapDataL(class TDesC16 const &)
-	?Type@CMemSpyApiKernelObject@@QBE?AW4TMemSpyDriverContainerType@@XZ @ 71 NONAME ; enum TMemSpyDriverContainerType CMemSpyApiKernelObject::Type(void) const
-	?Name@CMemSpyApiKernelObject@@QBEABVTDesC16@@XZ @ 72 NONAME ; class TDesC16 const & CMemSpyApiKernelObject::Name(void) const
-	?Fragmentation@CMemSpyApiHeap@@QAEHXZ @ 73 NONAME ; int CMemSpyApiHeap::Fragmentation(void)
-	?TimerType@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverTimerType@@XZ @ 74 NONAME ; enum TMemSpyDriverTimerType CMemSpyApiKernelObjectItem::TimerType(void) const
-	?Value@CMemSpyApiThreadInfoItem@@QBEABVTDesC16@@XZ @ 75 NONAME ; class TDesC16 const & CMemSpyApiThreadInfoItem::Value(void) const
-	?SecurityZone@CMemSpyApiKernelObjectItem@@QBEIXZ @ 76 NONAME ; unsigned int CMemSpyApiKernelObjectItem::SecurityZone(void) const
-	?CreatorId@CMemSpyApiKernelObjectItem@@QBEIXZ @ 77 NONAME ; unsigned int CMemSpyApiKernelObjectItem::CreatorId(void) const
-	?Order@CMemSpyApiKernelObjectItem@@QBEEXZ @ 78 NONAME ; unsigned char CMemSpyApiKernelObjectItem::Order(void) const
-	?NameDetail@CMemSpyApiKernelObjectItem@@QBEABVTDesC8@@XZ @ 79 NONAME ; class TDesC8 const & CMemSpyApiKernelObjectItem::NameDetail(void) const
-	?OutputStackInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 80 NONAME ; void RMemSpySession::OutputStackInfo(class TRequestStatus &)
-	?Handle@CMemSpyApiKernelObjectItem@@QBEPAXXZ @ 81 NONAME ; void * CMemSpyApiKernelObjectItem::Handle(void) const
-	?GetProcessesL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiProcess@@@@W4TSortType@@@Z @ 82 NONAME ; void RMemSpySession::GetProcessesL(class RArray<class CMemSpyApiProcess *> &, enum TSortType)
-	?ParseMask@CMemSpyApiKernelObjectItem@@QBEIXZ @ 83 NONAME ; unsigned int CMemSpyApiKernelObjectItem::ParseMask(void) const
-	?Attributes@CMemSpyApiKernelObjectItem@@QBEHXZ @ 84 NONAME ; int CMemSpyApiKernelObjectItem::Attributes(void) const
-	?MemoryDelta@CMemSpyApiMemoryTrackingCycle@@QBE_JXZ @ 85 NONAME ; long long CMemSpyApiMemoryTrackingCycle::MemoryDelta(void) const
-	?GetSwmtFilter@RMemSpySession@@QAEXAAV?$TBuf@$0IA@@@@Z @ 86 NONAME ; void RMemSpySession::GetSwmtFilter(class TBuf<128> &)
-	?Caption@CMemSpyApiThreadInfoItem@@QBEABVTDesC16@@XZ @ 87 NONAME ; class TDesC16 const & CMemSpyApiThreadInfoItem::Caption(void) const
-	?DebugAllocatorLibrary@CMemSpyApiHeap@@QAEHXZ @ 88 NONAME ; int CMemSpyApiHeap::DebugAllocatorLibrary(void)
-	?Overhead@CMemSpyApiHeap@@QAEHXZ @ 89 NONAME ; int CMemSpyApiHeap::Overhead(void)
-	?ForceSwmtUpdate@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 90 NONAME ; void RMemSpySession::ForceSwmtUpdate(class TRequestStatus &)
-	?GetHeapL@RMemSpySession@@QAEPAVCMemSpyApiHeap@@XZ @ 91 NONAME ; class CMemSpyApiHeap * RMemSpySession::GetHeapL(void)
-	?ServerListOutputGenericL@RMemSpySession@@QAEXH@Z @ 92 NONAME ; void RMemSpySession::ServerListOutputGenericL(int)
-	?OutputKernelStackData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 93 NONAME ; void RMemSpySession::OutputKernelStackData(class TRequestStatus &)
-	?GetSwmtTimerIntervalL@RMemSpySession@@QAEXAAH@Z @ 94 NONAME ; void RMemSpySession::GetSwmtTimerIntervalL(int &)
-	?GetSwmtHeapDumpsEnabledL@RMemSpySession@@QAEXAAH@Z @ 95 NONAME ; void RMemSpySession::GetSwmtHeapDumpsEnabledL(int &)
-	?AddressOfOwningThread@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 96 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfOwningThread(void)
-	?ThreadPriority@CMemSpyApiThread@@QBE?AW4TThreadPriority@@XZ @ 97 NONAME ; enum TThreadPriority CMemSpyApiThread::ThreadPriority(void) const
-	?GetHeap@RMemSpySession@@QAEPAVCMemSpyApiHeap@@XZ @ 98 NONAME ; class CMemSpyApiHeap * RMemSpySession::GetHeap(void)
-	??1CMemSpyApiMemoryTrackingCycle@@QAE@XZ @ 99 NONAME ; CMemSpyApiMemoryTrackingCycle::~CMemSpyApiMemoryTrackingCycle(void)
-	?AccessCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 100 NONAME ; int CMemSpyApiKernelObjectItem::AccessCount(void) const
-	?ChangeCount@CMemSpyApiMemoryTrackingCycle@@QBEHXZ @ 101 NONAME ; int CMemSpyApiMemoryTrackingCycle::ChangeCount(void) const
-	?OutputHeapInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 102 NONAME ; void RMemSpySession::OutputHeapInfo(class TRequestStatus &)
-	?Time@CMemSpyApiMemoryTrackingCycle@@QBEABVTTime@@XZ @ 103 NONAME ; class TTime const & CMemSpyApiMemoryTrackingCycle::Time(void) const
-	?SetSwmtTimerIntervalL@RMemSpySession@@QAEXH@Z @ 104 NONAME ; void RMemSpySession::SetSwmtTimerIntervalL(int)
-	?MaxLength@CMemSpyApiHeap@@QAEHXZ @ 105 NONAME ; int CMemSpyApiHeap::MaxLength(void)
-	?OutputKernelHeapData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 106 NONAME ; void RMemSpySession::OutputKernelHeapData(class TRequestStatus &)
-	?AddressOfKernelOwner@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 107 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfKernelOwner(void)
-	??1CMemSpyApiThreadInfoItem@@QAE@XZ @ 108 NONAME ; CMemSpyApiThreadInfoItem::~CMemSpyApiThreadInfoItem(void)
-	?FreeCount@CMemSpyApiHeap@@QAEHXZ @ 109 NONAME ; int CMemSpyApiHeap::FreeCount(void)
-	?TotalFree@CMemSpyApiHeap@@QAEHXZ @ 110 NONAME ; int CMemSpyApiHeap::TotalFree(void)
-	?SwitchToThread@RMemSpySession@@QAEHVTThreadId@@H@Z @ 111 NONAME ; int RMemSpySession::SwitchToThread(class TThreadId, int)
-	?GetServersL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiServer@@@@W4TSortType@@@Z @ 112 NONAME ; void RMemSpySession::GetServersL(class RArray<class CMemSpyApiServer *> &, enum TSortType)
-	?FreeOverhead@CMemSpyApiHeap@@QAEHXZ @ 113 NONAME ; int CMemSpyApiHeap::FreeOverhead(void)
-	?SwitchOutputToTraceL@RMemSpySession@@QAEXXZ @ 114 NONAME ; void RMemSpySession::SwitchOutputToTraceL(void)
-	?SlackFreeSpace@CMemSpyApiHeap@@QAEHXZ @ 115 NONAME ; int CMemSpyApiHeap::SlackFreeSpace(void)
-	?Priority@CMemSpyApiKernelObjectItem@@QBEHXZ @ 116 NONAME ; int CMemSpyApiKernelObjectItem::Priority(void) const
-	?ForceSwmtUpdateL@RMemSpySession@@QAEXXZ @ 117 NONAME ; void RMemSpySession::ForceSwmtUpdateL(void)
-	?ThreadCount@CMemSpyApiProcess@@QBEHXZ @ 118 NONAME ; int CMemSpyApiProcess::ThreadCount(void) const
-	?RequestCount@CMemSpyApiThread@@QBEHXZ @ 119 NONAME ; int CMemSpyApiThread::RequestCount(void) const
-	?Caption@CMemSpyApiMemoryTrackingCycle@@QBEABVTDesC16@@XZ @ 120 NONAME ; class TDesC16 const & CMemSpyApiMemoryTrackingCycle::Caption(void) const
-	?StopSwmtTimerL@RMemSpySession@@QAEXXZ @ 121 NONAME ; void RMemSpySession::StopSwmtTimerL(void)
-	??1CMemSpyApiProcess@@QAE@XZ @ 122 NONAME ; CMemSpyApiProcess::~CMemSpyApiProcess(void)
-	?MinLength@CMemSpyApiHeap@@QAEHXZ @ 123 NONAME ; int CMemSpyApiHeap::MinLength(void)
-	?ExitCategory@CMemSpyApiProcess@@QBE?AV?$TBuf@$0BA@@@XZ @ 124 NONAME ; class TBuf<16> CMemSpyApiProcess::ExitCategory(void) const
-	?Progress@TMemSpyDeviceWideOperationProgress@@QBEHXZ @ 125 NONAME ; int TMemSpyDeviceWideOperationProgress::Progress(void) const
-	?Count@CMemSpyApiKernelObject@@QBEHXZ @ 126 NONAME ; int CMemSpyApiKernelObject::Count(void) const
-	?IsDead@CMemSpyApiProcess@@QBEHXZ @ 127 NONAME ; int CMemSpyApiProcess::IsDead(void) const
-	?EndThreadL@RMemSpySession@@QAEHVTThreadId@@W4TMemSpyEndType@@@Z @ 128 NONAME ; int RMemSpySession::EndThreadL(class TThreadId, enum TMemSpyEndType)
-	?StartPos@CMemSpyApiKernelObjectItem@@QBEHXZ @ 129 NONAME ; int CMemSpyApiKernelObjectItem::StartPos(void) const
-	?TimerState@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverTimerState@@XZ @ 130 NONAME ; enum TMemSpyDriverTimerState CMemSpyApiKernelObjectItem::TimerState(void) const
-	?BaseAddress@CMemSpyApiHeap@@QAEHXZ @ 131 NONAME ; int CMemSpyApiHeap::BaseAddress(void)
-	?ExitType@CMemSpyApiThread@@QBE?AW4TExitType@@XZ @ 132 NONAME ; enum TExitType CMemSpyApiThread::ExitType(void) const
-	?StartSwmtTimerL@RMemSpySession@@QAEXH@Z @ 133 NONAME ; void RMemSpySession::StartSwmtTimerL(int)
-	?Type@CMemSpyApiHeap@@QAEAAVTDesC16@@XZ @ 134 NONAME ; class TDesC16 & CMemSpyApiHeap::Type(void)
-	?GetOutputSink@RMemSpySession@@QAEXAAW4TMemSpySinkType@@@Z @ 135 NONAME ; void RMemSpySession::GetOutputSink(enum TMemSpySinkType &)
-	?Id@CMemSpyApiProcess@@QBE?AVTProcessId@@XZ @ 136 NONAME ; class TProcessId CMemSpyApiProcess::Id(void) const
-	?BiggestAllocation@CMemSpyApiHeap@@QAEHXZ @ 137 NONAME ; int CMemSpyApiHeap::BiggestAllocation(void)
-	??1CMemSpyApiKernelObjectItem@@QAE@XZ @ 138 NONAME ; CMemSpyApiKernelObjectItem::~CMemSpyApiKernelObjectItem(void)
-	?AllocationOverhead@CMemSpyApiHeap@@QAEHXZ @ 139 NONAME ; int CMemSpyApiHeap::AllocationOverhead(void)
-	?NameOfOwner@CMemSpyApiKernelObjectItem@@QBEABVTDesC8@@XZ @ 140 NONAME ; class TDesC8 const & CMemSpyApiKernelObjectItem::NameOfOwner(void) const
-	?OutputAllContainerContents@RMemSpySession@@QAEXXZ @ 141 NONAME ; void RMemSpySession::OutputAllContainerContents(void)
-	?OutputKernelObjectsL@RMemSpySession@@QAEXXZ @ 142 NONAME ; void RMemSpySession::OutputKernelObjectsL(void)
-	?ThreadSystemPermanentOrCritical@RMemSpySession@@QAEHVTThreadId@@H@Z @ 143 NONAME ; int RMemSpySession::ThreadSystemPermanentOrCritical(class TThreadId, int)
-	?Protection@CMemSpyApiKernelObjectItem@@QBEIXZ @ 144 NONAME ; unsigned int CMemSpyApiKernelObjectItem::Protection(void) const
-	?BiggestFree@CMemSpyApiHeap@@QAEHXZ @ 145 NONAME ; int CMemSpyApiHeap::BiggestFree(void)
-	?Attributes@CMemSpyApiThread@@QBEHXZ @ 146 NONAME ; int CMemSpyApiThread::Attributes(void) const
-	?GetSwmtCyclesCount@RMemSpySession@@QAEHXZ @ 147 NONAME ; int RMemSpySession::GetSwmtCyclesCount(void)
-	?Bottom@CMemSpyApiKernelObjectItem@@QBEHXZ @ 148 NONAME ; int CMemSpyApiKernelObjectItem::Bottom(void) const
-	?StartSwmtTimerL@RMemSpySession@@QAEXXZ @ 149 NONAME ; void RMemSpySession::StartSwmtTimerL(void)
-	?EndProcessL@RMemSpySession@@QAEHVTProcessId@@W4TMemSpyEndType@@@Z @ 150 NONAME ; int RMemSpySession::EndProcessL(class TProcessId, enum TMemSpyEndType)
-	?GetKernelObjectItemsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiKernelObjectItem@@@@W4TMemSpyDriverContainerType@@@Z @ 151 NONAME ; void RMemSpySession::GetKernelObjectItemsL(class RArray<class CMemSpyApiKernelObjectItem *> &, enum TMemSpyDriverContainerType)
-	?NotifyDeviceWideOperationProgress@RMemSpySession@@QAEXAAVTMemSpyDeviceWideOperationProgress@@AAVTRequestStatus@@@Z @ 152 NONAME ; void RMemSpySession::NotifyDeviceWideOperationProgress(class TMemSpyDeviceWideOperationProgress &, class TRequestStatus &)
-	?OutputCompactHeapInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 153 NONAME ; void RMemSpySession::OutputCompactHeapInfo(class TRequestStatus &)
-	?OutputPhoneInfo@RMemSpySession@@QAEXXZ @ 154 NONAME ; void RMemSpySession::OutputPhoneInfo(void)
-	?ThreadHandles@CMemSpyApiThread@@QBEHXZ @ 155 NONAME ; int CMemSpyApiThread::ThreadHandles(void) const
-	?SvrSessionType@CMemSpyApiKernelObjectItem@@QBEEXZ @ 156 NONAME ; unsigned char CMemSpyApiKernelObjectItem::SvrSessionType(void) const
-	?SwitchOutputSinkL@RMemSpySession@@QAEXW4TMemSpySinkType@@@Z @ 157 NONAME ; void RMemSpySession::SwitchOutputSinkL(enum TMemSpySinkType)
-	?ChunkType@CMemSpyApiKernelObjectItem@@QBEIXZ @ 158 NONAME ; unsigned int CMemSpyApiKernelObjectItem::ChunkType(void) const
-	?GetSwmtMode@RMemSpySession@@QAEXAAW4TMemSpyEngineSysMemTrackerMode@TMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 159 NONAME ; void RMemSpySession::GetSwmtMode(enum TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode &)
-	?Id@CMemSpyApiThread@@QBE?AVTThreadId@@XZ @ 160 NONAME ; class TThreadId CMemSpyApiThread::Id(void) const
-	?OutputPhoneInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 161 NONAME ; void RMemSpySession::OutputPhoneInfo(class TRequestStatus &)
-	?GetProcessIdByNameL@RMemSpySession@@QAE?AVTProcessId@@ABVTDesC16@@@Z @ 162 NONAME ; class TProcessId RMemSpySession::GetProcessIdByNameL(class TDesC16 const &)
-	?GetMemoryTrackingCyclesL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiMemoryTrackingCycle@@@@@Z @ 163 NONAME ; void RMemSpySession::GetMemoryTrackingCyclesL(class RArray<class CMemSpyApiMemoryTrackingCycle *> &)
-	?MapAttr@CMemSpyApiKernelObjectItem@@QBEIXZ @ 164 NONAME ; unsigned int CMemSpyApiKernelObjectItem::MapAttr(void) const
-	?OutputCompactStackInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 165 NONAME ; void RMemSpySession::OutputCompactStackInfo(class TRequestStatus &)
-	?VID@CMemSpyApiProcess@@QBEKXZ @ 166 NONAME ; unsigned long CMemSpyApiProcess::VID(void) const
-	?AddressOfCodeSeg@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 167 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfCodeSeg(void)
-	?GetThreadsL@RMemSpySession@@QAEXVTProcessId@@AAV?$RArray@PAVCMemSpyApiThread@@@@W4TSortType@@@Z @ 168 NONAME ; void RMemSpySession::GetThreadsL(class TProcessId, class RArray<class CMemSpyApiThread *> &, enum TSortType)
-	?ProcessId@CMemSpyApiThread@@QBE?AVTProcessId@@XZ @ 169 NONAME ; class TProcessId CMemSpyApiThread::ProcessId(void) const
-	?Type@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverContainerType@@XZ @ 170 NONAME ; enum TMemSpyDriverContainerType CMemSpyApiKernelObjectItem::Type(void) const
-	?ChunkSize@CMemSpyApiHeap@@QAEHXZ @ 171 NONAME ; int CMemSpyApiHeap::ChunkSize(void)
-	?UnitsMask@CMemSpyApiKernelObjectItem@@QBEIXZ @ 172 NONAME ; unsigned int CMemSpyApiKernelObjectItem::UnitsMask(void) const
-	?Name@CMemSpyApiServer@@QBEABVTDesC16@@XZ @ 173 NONAME ; class TDesC16 const & CMemSpyApiServer::Name(void) const
-	?State@CMemSpyApiKernelObjectItem@@QBEEXZ @ 174 NONAME ; unsigned char CMemSpyApiKernelObjectItem::State(void) const
-	?Shared@CMemSpyApiHeap@@QAEHXZ @ 175 NONAME ; int CMemSpyApiHeap::Shared(void)
-	?SetSwmtAutoStartProcessList@RMemSpySession@@QAEXPAV?$CArrayFixFlat@VTUid@@@@@Z @ 176 NONAME ; void RMemSpySession::SetSwmtAutoStartProcessList(class CArrayFixFlat<class TUid> *)
-	?OutputCompactHeapInfoL@RMemSpySession@@QAEXXZ @ 177 NONAME ; void RMemSpySession::OutputCompactHeapInfoL(void)
-	?ProcessSystemPermanentOrCritical@RMemSpySession@@QAEHVTProcessId@@H@Z @ 178 NONAME ; int RMemSpySession::ProcessSystemPermanentOrCritical(class TProcessId, int)
-	??1CMemSpyApiServer@@QAE@XZ @ 179 NONAME ; CMemSpyApiServer::~CMemSpyApiServer(void)
-	?SetSwmtMode@RMemSpySession@@QAEXW4TMemSpyEngineSysMemTrackerMode@TMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 180 NONAME ; void RMemSpySession::SetSwmtMode(enum TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode)
-	?OutputKernelHeapDataL@RMemSpySession@@QAEXXZ @ 181 NONAME ; void RMemSpySession::OutputKernelHeapDataL(void)
-	?Id@CMemSpyApiServer@@QBE?AVTProcessId@@XZ @ 182 NONAME ; class TProcessId CMemSpyApiServer::Id(void) const
-	?MapCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 183 NONAME ; int CMemSpyApiKernelObjectItem::MapCount(void) const
-	?OpenChannels@CMemSpyApiKernelObjectItem@@QAEHXZ @ 184 NONAME ; int CMemSpyApiKernelObjectItem::OpenChannels(void)
-	?ProcessPriority@CMemSpyApiThread@@QBE?AW4TProcessPriority@@XZ @ 185 NONAME ; enum TProcessPriority CMemSpyApiThread::ProcessPriority(void) const
-	?OutputAOListL@RMemSpySession@@QAEXVTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 186 NONAME ; void RMemSpySession::OutputAOListL(class TThreadId, enum TMemSpyThreadInfoItemType)
-	?ThreadNumberUsing@CMemSpyApiThread@@QBEHXZ @ 187 NONAME ; int CMemSpyApiThread::ThreadNumberUsing(void) const
-	?OutputHeapInfoUserL@RMemSpySession@@QAEXVTThreadId@@@Z @ 188 NONAME ; void RMemSpySession::OutputHeapInfoUserL(class TThreadId)
-	?OutputThreadCellListL@RMemSpySession@@QAEXVTThreadId@@@Z @ 189 NONAME ; void RMemSpySession::OutputThreadCellListL(class TThreadId)
-	?SessionCount@CMemSpyApiServer@@QBEHXZ @ 190 NONAME ; int CMemSpyApiServer::SessionCount(void) const
-	??1CMemSpyApiThread@@QAE@XZ @ 191 NONAME ; CMemSpyApiThread::~CMemSpyApiThread(void)
-	?Connect@RMemSpySession@@QAEHXZ @ 192 NONAME ; int RMemSpySession::Connect(void)
-	?GetThreadInfoItems@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiThreadInfoItem@@@@VTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 193 NONAME ; int RMemSpySession::GetThreadInfoItems(class RArray<class CMemSpyApiThreadInfoItem *> &, class TThreadId, enum TMemSpyThreadInfoItemType)
-	?SID@CMemSpyApiThread@@QBEHXZ @ 194 NONAME ; int CMemSpyApiThread::SID(void) const
-	?GetKernelObjectItems@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiKernelObjectItem@@@@W4TMemSpyDriverContainerType@@@Z @ 195 NONAME ; int RMemSpySession::GetKernelObjectItems(class RArray<class CMemSpyApiKernelObjectItem *> &, enum TMemSpyDriverContainerType)
-	?ProcessHandles@CMemSpyApiThread@@QBEHXZ @ 196 NONAME ; int CMemSpyApiThread::ProcessHandles(void) const
-	?Name@CMemSpyApiThread@@QBEABVTDesC16@@XZ @ 197 NONAME ; class TDesC16 const & CMemSpyApiThread::Name(void) const
-	?Id@CMemSpyApiEComCategory@@QBE?AVTUid@@XZ @ 198 NONAME ; class TUid CMemSpyApiEComCategory::Id(void) const
-	??1CMemSpyApiEComCategory@@UAE@XZ @ 199 NONAME ; CMemSpyApiEComCategory::~CMemSpyApiEComCategory(void)
-	?ImplementationUid@CMemSpyApiEComImplementation@@QBE?AVTUid@@XZ @ 200 NONAME ; class TUid CMemSpyApiEComImplementation::ImplementationUid(void) const
-	?DataType@CMemSpyApiEComImplementation@@QBEABVTDesC16@@XZ @ 201 NONAME ; class TDesC16 const & CMemSpyApiEComImplementation::DataType(void) const
-	?OpaqueData@CMemSpyApiEComImplementation@@QBEABVTDesC16@@XZ @ 202 NONAME ; class TDesC16 const & CMemSpyApiEComImplementation::OpaqueData(void) const
-	?GetEComCategoriesL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiEComCategory@@@@@Z @ 203 NONAME ; void RMemSpySession::GetEComCategoriesL(class RArray<class CMemSpyApiEComCategory *> &)
-	?Name@CMemSpyApiEComImplementation@@QBEABVTDesC16@@XZ @ 204 NONAME ; class TDesC16 const & CMemSpyApiEComImplementation::Name(void) const
-	?Drive@CMemSpyApiEComImplementation@@QBE?AVTDriveUnit@@XZ @ 205 NONAME ; class TDriveUnit CMemSpyApiEComImplementation::Drive(void) const
-	?VendorId@CMemSpyApiEComImplementation@@QBE?AVTVendorId@@XZ @ 206 NONAME ; class TVendorId CMemSpyApiEComImplementation::VendorId(void) const
-	?Version@CMemSpyApiEComImplementation@@QBEHXZ @ 207 NONAME ; int CMemSpyApiEComImplementation::Version(void) const
-	?Name@CMemSpyApiEComCategory@@QBEABVTDesC16@@XZ @ 208 NONAME ; class TDesC16 const & CMemSpyApiEComCategory::Name(void) const
-	?GetEComImplementationsL@RMemSpySession@@QAEXVTUid@@AAV?$RArray@PAVCMemSpyApiEComImplementation@@@@@Z @ 209 NONAME ; void RMemSpySession::GetEComImplementationsL(class TUid, class RArray<class CMemSpyApiEComImplementation *> &)
-	??1CMemSpyApiEComImplementation@@UAE@XZ @ 210 NONAME ; CMemSpyApiEComImplementation::~CMemSpyApiEComImplementation(void)
-	?InterfaceCount@CMemSpyApiEComCategory@@QBEHXZ @ 211 NONAME ; int CMemSpyApiEComCategory::InterfaceCount(void) const
-	?Id@CMemSpyApiEComInterface@@QBE?AVTUid@@XZ @ 212 NONAME ; class TUid CMemSpyApiEComInterface::Id(void) const
-	?RomBased@CMemSpyApiEComImplementation@@QBEHXZ @ 213 NONAME ; int CMemSpyApiEComImplementation::RomBased(void) const
-	?RomOnly@CMemSpyApiEComImplementation@@QBEHXZ @ 214 NONAME ; int CMemSpyApiEComImplementation::RomOnly(void) const
-	?GetEComInterfacesL@RMemSpySession@@QAEXVTUid@@AAV?$RArray@PAVCMemSpyApiEComInterface@@@@@Z @ 215 NONAME ; void RMemSpySession::GetEComInterfacesL(class TUid, class RArray<class CMemSpyApiEComInterface *> &)
-	?ImplementationCount@CMemSpyApiEComInterface@@QBEHXZ @ 216 NONAME ; int CMemSpyApiEComInterface::ImplementationCount(void) const
-	??1CMemSpyApiEComInterface@@UAE@XZ @ 217 NONAME ; CMemSpyApiEComInterface::~CMemSpyApiEComInterface(void)
-	?Name@CMemSpyApiEComInterface@@QBEABVTDesC16@@XZ @ 218 NONAME ; class TDesC16 const & CMemSpyApiEComInterface::Name(void) const
-	?Disabled@CMemSpyApiEComImplementation@@QBEHXZ @ 219 NONAME ; int CMemSpyApiEComImplementation::Disabled(void) const
+	?DocName@CMemSpyApiWindowGroup@@QBEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CMemSpyApiWindowGroup::DocName(void) const
+	?ProcessId@CMemSpyApiServer@@QBE?AVTProcessId@@XZ @ 12 NONAME ; class TProcessId CMemSpyApiServer::ProcessId(void) const
+	?VID@CMemSpyApiThread@@QBEHXZ @ 13 NONAME ; int CMemSpyApiThread::VID(void) const
+	?IsHidden@CMemSpyApiWindowGroup@@QBEHXZ @ 14 NONAME ; int CMemSpyApiWindowGroup::IsHidden(void) const
+	?Id@CMemSpyApiEComCategory@@QBE?AVTUid@@XZ @ 15 NONAME ; class TUid CMemSpyApiEComCategory::Id(void) const
+	?OutputStackInfoL@RMemSpySession@@QAEXVTThreadId@@@Z @ 16 NONAME ; void RMemSpySession::OutputStackInfoL(class TThreadId)
+	?FreeMemory@CMemSpyApiMemoryTrackingCycle@@QBEAB_JXZ @ 17 NONAME ; long long const & CMemSpyApiMemoryTrackingCycle::FreeMemory(void) const
+	?ProcessNumberUsing@CMemSpyApiThread@@QBEHXZ @ 18 NONAME ; int CMemSpyApiThread::ProcessNumberUsing(void) const
+	?PreviousCycleDiff@CMemSpyApiMemoryTrackingCycle@@QBE_JXZ @ 19 NONAME ; long long CMemSpyApiMemoryTrackingCycle::PreviousCycleDiff(void) const
+	?OutputStackDataL@RMemSpySession@@QAEXVTThreadId@@W4TMemSpyDriverDomainType@@@Z @ 20 NONAME ; void RMemSpySession::OutputStackDataL(class TThreadId, enum TMemSpyDriverDomainType)
+	?OutputThreadHeapDataL@RMemSpySession@@QAEXVTThreadId@@@Z @ 21 NONAME ; void RMemSpySession::OutputThreadHeapDataL(class TThreadId)
+	?ExitType@CMemSpyApiProcess@@QBE?AW4TExitType@@XZ @ 22 NONAME ; enum TExitType CMemSpyApiProcess::ExitType(void) const
+	?SwitchOutputToFileL@RMemSpySession@@QAEXABVTDesC16@@@Z @ 23 NONAME ; void RMemSpySession::SwitchOutputToFileL(class TDesC16 const &)
+	?OutputHeapCellListing@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 24 NONAME ; void RMemSpySession::OutputHeapCellListing(class TRequestStatus &)
+	?SetThreadPriorityL@RMemSpySession@@QAEXVTThreadId@@H@Z @ 25 NONAME ; void RMemSpySession::SetThreadPriorityL(class TThreadId, int)
+	?Restrictions@CMemSpyApiKernelObjectItem@@QBEIXZ @ 26 NONAME ; unsigned int CMemSpyApiKernelObjectItem::Restrictions(void) const
+	?Id@CMemSpyApiKernelObjectItem@@QBEHXZ @ 27 NONAME ; int CMemSpyApiKernelObjectItem::Id(void) const
+	?Count@CMemSpyApiKernelObjectItem@@QBEHXZ @ 28 NONAME ; int CMemSpyApiKernelObjectItem::Count(void) const
+	??1CMemSpyApiEComCategory@@UAE@XZ @ 29 NONAME ; CMemSpyApiEComCategory::~CMemSpyApiEComCategory(void)
+	?ControllingOwner@CMemSpyApiKernelObjectItem@@QBEIXZ @ 30 NONAME ; unsigned int CMemSpyApiKernelObjectItem::ControllingOwner(void) const
+	?Priority@CMemSpyApiWindowGroup@@QBEHXZ @ 31 NONAME ; int CMemSpyApiWindowGroup::Priority(void) const
+	?SwmtResetTracking@RMemSpySession@@QAEXXZ @ 32 NONAME ; void RMemSpySession::SwmtResetTracking(void)
+	?Version@CMemSpyApiKernelObjectItem@@QBE?AVTVersion@@XZ @ 33 NONAME ; class TVersion CMemSpyApiKernelObjectItem::Version(void) const
+	?SwitchToProcess@RMemSpySession@@QAEHVTProcessId@@H@Z @ 34 NONAME ; int RMemSpySession::SwitchToProcess(class TProcessId, int)
+	?MaxSize@CMemSpyApiKernelObjectItem@@QBEHXZ @ 35 NONAME ; int CMemSpyApiKernelObjectItem::MaxSize(void) const
+	?IsSwmtRunningL@RMemSpySession@@QAEHXZ @ 36 NONAME ; int RMemSpySession::IsSwmtRunningL(void)
+	?AddressOfOwningProcess@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 37 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfOwningProcess(void)
+	?ExitReason@CMemSpyApiProcess@@QBEHXZ @ 38 NONAME ; int CMemSpyApiProcess::ExitReason(void) const
+	?MsgCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 39 NONAME ; int CMemSpyApiKernelObjectItem::MsgCount(void) const
+	?ImplementationUid@CMemSpyApiEComImplementation@@QBE?AVTUid@@XZ @ 40 NONAME ; class TUid CMemSpyApiEComImplementation::ImplementationUid(void) const
+	?DataType@CMemSpyApiEComImplementation@@QBEABVTDesC16@@XZ @ 41 NONAME ; class TDesC16 const & CMemSpyApiEComImplementation::DataType(void) const
+	?AllocationsCount@CMemSpyApiHeap@@QAEHXZ @ 42 NONAME ; int CMemSpyApiHeap::AllocationsCount(void)
+	?WaitCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 43 NONAME ; int CMemSpyApiKernelObjectItem::WaitCount(void) const
+	?SID@CMemSpyApiProcess@@QBEKXZ @ 44 NONAME ; unsigned long CMemSpyApiProcess::SID(void) const
+	?ThreadId@CMemSpyApiWindowGroup@@QBE?AVTThreadId@@XZ @ 45 NONAME ; class TThreadId CMemSpyApiWindowGroup::ThreadId(void) const
+	?GetKernelObjectsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiKernelObject@@@@@Z @ 46 NONAME ; void RMemSpySession::GetKernelObjectsL(class RArray<class CMemSpyApiKernelObject *> &)
+	?CycleNumber@CMemSpyApiMemoryTrackingCycle@@QBEHXZ @ 47 NONAME ; int CMemSpyApiMemoryTrackingCycle::CycleNumber(void) const
+	?OpaqueData@CMemSpyApiEComImplementation@@QBEABVTDesC16@@XZ @ 48 NONAME ; class TDesC16 const & CMemSpyApiEComImplementation::OpaqueData(void) const
+	?GetEComCategoriesL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiEComCategory@@@@@Z @ 49 NONAME ; void RMemSpySession::GetEComCategoriesL(class RArray<class CMemSpyApiEComCategory *> &)
+	?Size@CMemSpyApiKernelObject@@QBE_JXZ @ 50 NONAME ; long long CMemSpyApiKernelObject::Size(void) const
+	?SetSwmtCategoriesL@RMemSpySession@@QAEXH@Z @ 51 NONAME ; void RMemSpySession::SetSwmtCategoriesL(int)
+	?CancelDeviceWideOperationL@RMemSpySession@@QAEXXZ @ 52 NONAME ; void RMemSpySession::CancelDeviceWideOperationL(void)
+	?TotalAllocations@CMemSpyApiHeap@@QAEHXZ @ 53 NONAME ; int CMemSpyApiHeap::TotalAllocations(void)
+	?Name@CMemSpyApiProcess@@QBEABVTDesC16@@XZ @ 54 NONAME ; class TDesC16 const & CMemSpyApiProcess::Name(void) const
+	?DumpKernelHeap@RMemSpySession@@QAEXXZ @ 55 NONAME ; void RMemSpySession::DumpKernelHeap(void)
+	?GetKernelObjects@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiKernelObject@@@@@Z @ 56 NONAME ; int RMemSpySession::GetKernelObjects(class RArray<class CMemSpyApiKernelObject *> &)
+	?Priority@CMemSpyApiProcess@@QBE?AW4TProcessPriority@@XZ @ 57 NONAME ; enum TProcessPriority CMemSpyApiProcess::Priority(void) const
+	?HeaderSizeF@CMemSpyApiHeap@@QAEHXZ @ 58 NONAME ; int CMemSpyApiHeap::HeaderSizeF(void)
+	?OutputCompactStackInfoL@RMemSpySession@@QAEXXZ @ 59 NONAME ; void RMemSpySession::OutputCompactStackInfoL(void)
+	?MsgLimit@CMemSpyApiKernelObjectItem@@QBEHXZ @ 60 NONAME ; int CMemSpyApiKernelObjectItem::MsgLimit(void) const
+	?AddressOfDataBssStackChunk@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 61 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfDataBssStackChunk(void)
+	?Top@CMemSpyApiKernelObjectItem@@QBEHXZ @ 62 NONAME ; int CMemSpyApiKernelObjectItem::Top(void) const
+	?Resetting@CMemSpyApiKernelObjectItem@@QBEEXZ @ 63 NONAME ; unsigned char CMemSpyApiKernelObjectItem::Resetting(void) const
+	?GetProcessIdByThreadId@RMemSpySession@@QAEXAAVTProcessId@@VTThreadId@@@Z @ 64 NONAME ; void RMemSpySession::GetProcessIdByThreadId(class TProcessId &, class TThreadId)
+	?GetWindowGroupsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiWindowGroup@@@@@Z @ 65 NONAME ; void RMemSpySession::GetWindowGroupsL(class RArray<class CMemSpyApiWindowGroup *> &)
+	?HeaderSizeA@CMemSpyApiHeap@@QAEHXZ @ 66 NONAME ; int CMemSpyApiHeap::HeaderSizeA(void)
+	?OutputHeapData@RMemSpySession@@QAEXXZ @ 67 NONAME ; void RMemSpySession::OutputHeapData(void)
+	?TotalAccessCount@CMemSpyApiKernelObjectItem@@QBEGXZ @ 68 NONAME ; unsigned short CMemSpyApiKernelObjectItem::TotalAccessCount(void) const
+	?Name@CMemSpyApiEComImplementation@@QBEABVTDesC16@@XZ @ 69 NONAME ; class TDesC16 const & CMemSpyApiEComImplementation::Name(void) const
+	?Changes@CMemSpyApiKernelObjectItem@@QBEIXZ @ 70 NONAME ; unsigned int CMemSpyApiKernelObjectItem::Changes(void) const
+	??0RMemSpySession@@QAE@XZ @ 71 NONAME ; RMemSpySession::RMemSpySession(void)
+	?OutputUserStackData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 72 NONAME ; void RMemSpySession::OutputUserStackData(class TRequestStatus &)
+	?Drive@CMemSpyApiEComImplementation@@QBE?AVTDriveUnit@@XZ @ 73 NONAME ; class TDriveUnit CMemSpyApiEComImplementation::Drive(void) const
+	?AddressOfServer@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 74 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfServer(void)
+	?VendorId@CMemSpyApiEComImplementation@@QBE?AVTVendorId@@XZ @ 75 NONAME ; class TVendorId CMemSpyApiEComImplementation::VendorId(void) const
+	?Version@CMemSpyApiEComImplementation@@QBEHXZ @ 76 NONAME ; int CMemSpyApiEComImplementation::Version(void) const
+	?Size@CMemSpyApiHeap@@QAEHXZ @ 77 NONAME ; int CMemSpyApiHeap::Size(void)
+	?GetServersL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiServer@@@@@Z @ 78 NONAME ; void RMemSpySession::GetServersL(class RArray<class CMemSpyApiServer *> &)
+	?GetInfoItemType@RMemSpySession@@QAEHHVTThreadId@@AAW4TMemSpyThreadInfoItemType@@@Z @ 79 NONAME ; int RMemSpySession::GetInfoItemType(int, class TThreadId, enum TMemSpyThreadInfoItemType &)
+	??1CMemSpyApiKernelObject@@QAE@XZ @ 80 NONAME ; CMemSpyApiKernelObject::~CMemSpyApiKernelObject(void)
+	??1CMemSpyApiHeap@@QAE@XZ @ 81 NONAME ; CMemSpyApiHeap::~CMemSpyApiHeap(void)
+	?SetSwmtHeapDumpsEnabledL@RMemSpySession@@QAEXH@Z @ 82 NONAME ; void RMemSpySession::SetSwmtHeapDumpsEnabledL(int)
+	?SetSwmtFilter@RMemSpySession@@QAEXABVTDesC16@@@Z @ 83 NONAME ; void RMemSpySession::SetSwmtFilter(class TDesC16 const &)
+	?Name@CMemSpyApiEComCategory@@QBEABVTDesC16@@XZ @ 84 NONAME ; class TDesC16 const & CMemSpyApiEComCategory::Name(void) const
+	?Size@CMemSpyApiKernelObjectItem@@QBEKXZ @ 85 NONAME ; unsigned long CMemSpyApiKernelObjectItem::Size(void) const
+	?OutputThreadInfoHandlesL@RMemSpySession@@QAEXVTThreadId@@@Z @ 86 NONAME ; void RMemSpySession::OutputThreadInfoHandlesL(class TThreadId)
+	?OutputThreadHeapDataL@RMemSpySession@@QAEXABVTDesC16@@@Z @ 87 NONAME ; void RMemSpySession::OutputThreadHeapDataL(class TDesC16 const &)
+	?GetEComImplementationsL@RMemSpySession@@QAEXVTUid@@AAV?$RArray@PAVCMemSpyApiEComImplementation@@@@@Z @ 88 NONAME ; void RMemSpySession::GetEComImplementationsL(class TUid, class RArray<class CMemSpyApiEComImplementation *> &)
+	?Type@CMemSpyApiKernelObject@@QBE?AW4TMemSpyDriverContainerType@@XZ @ 89 NONAME ; enum TMemSpyDriverContainerType CMemSpyApiKernelObject::Type(void) const
+	?Name@CMemSpyApiKernelObject@@QBEABVTDesC16@@XZ @ 90 NONAME ; class TDesC16 const & CMemSpyApiKernelObject::Name(void) const
+	?Fragmentation@CMemSpyApiHeap@@QAEHXZ @ 91 NONAME ; int CMemSpyApiHeap::Fragmentation(void)
+	?TimerType@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverTimerType@@XZ @ 92 NONAME ; enum TMemSpyDriverTimerType CMemSpyApiKernelObjectItem::TimerType(void) const
+	?Value@CMemSpyApiThreadInfoItem@@QBEABVTDesC16@@XZ @ 93 NONAME ; class TDesC16 const & CMemSpyApiThreadInfoItem::Value(void) const
+	?SecurityZone@CMemSpyApiKernelObjectItem@@QBEIXZ @ 94 NONAME ; unsigned int CMemSpyApiKernelObjectItem::SecurityZone(void) const
+	?CreatorId@CMemSpyApiKernelObjectItem@@QBEIXZ @ 95 NONAME ; unsigned int CMemSpyApiKernelObjectItem::CreatorId(void) const
+	?Order@CMemSpyApiKernelObjectItem@@QBEEXZ @ 96 NONAME ; unsigned char CMemSpyApiKernelObjectItem::Order(void) const
+	?NameDetail@CMemSpyApiKernelObjectItem@@QBEABVTDesC8@@XZ @ 97 NONAME ; class TDesC8 const & CMemSpyApiKernelObjectItem::NameDetail(void) const
+	??1CMemSpyApiEComImplementation@@UAE@XZ @ 98 NONAME ; CMemSpyApiEComImplementation::~CMemSpyApiEComImplementation(void)
+	?OutputStackInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 99 NONAME ; void RMemSpySession::OutputStackInfo(class TRequestStatus &)
+	?Handle@CMemSpyApiKernelObjectItem@@QBEPAXXZ @ 100 NONAME ; void * CMemSpyApiKernelObjectItem::Handle(void) const
+	?GetProcessesL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiProcess@@@@W4TSortType@@@Z @ 101 NONAME ; void RMemSpySession::GetProcessesL(class RArray<class CMemSpyApiProcess *> &, enum TSortType)
+	?ParseMask@CMemSpyApiKernelObjectItem@@QBEIXZ @ 102 NONAME ; unsigned int CMemSpyApiKernelObjectItem::ParseMask(void) const
+	?Attributes@CMemSpyApiKernelObjectItem@@QBEHXZ @ 103 NONAME ; int CMemSpyApiKernelObjectItem::Attributes(void) const
+	?MemoryDelta@CMemSpyApiMemoryTrackingCycle@@QBE_JXZ @ 104 NONAME ; long long CMemSpyApiMemoryTrackingCycle::MemoryDelta(void) const
+	?GetSwmtFilter@RMemSpySession@@QAEXAAV?$TBuf@$0IA@@@@Z @ 105 NONAME ; void RMemSpySession::GetSwmtFilter(class TBuf<128> &)
+	?Caption@CMemSpyApiThreadInfoItem@@QBEABVTDesC16@@XZ @ 106 NONAME ; class TDesC16 const & CMemSpyApiThreadInfoItem::Caption(void) const
+	?DebugAllocatorLibrary@CMemSpyApiHeap@@QAEHXZ @ 107 NONAME ; int CMemSpyApiHeap::DebugAllocatorLibrary(void)
+	?Overhead@CMemSpyApiHeap@@QAEHXZ @ 108 NONAME ; int CMemSpyApiHeap::Overhead(void)
+	?InterfaceCount@CMemSpyApiEComCategory@@QBEHXZ @ 109 NONAME ; int CMemSpyApiEComCategory::InterfaceCount(void) const
+	?ForceSwmtUpdate@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 110 NONAME ; void RMemSpySession::ForceSwmtUpdate(class TRequestStatus &)
+	?GetHeapL@RMemSpySession@@QAEPAVCMemSpyApiHeap@@XZ @ 111 NONAME ; class CMemSpyApiHeap * RMemSpySession::GetHeapL(void)
+	?ServerListOutputGenericL@RMemSpySession@@QAEXH@Z @ 112 NONAME ; void RMemSpySession::ServerListOutputGenericL(int)
+	?OutputKernelStackData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 113 NONAME ; void RMemSpySession::OutputKernelStackData(class TRequestStatus &)
+	?GetSwmtTimerIntervalL@RMemSpySession@@QAEXAAH@Z @ 114 NONAME ; void RMemSpySession::GetSwmtTimerIntervalL(int &)
+	?GetSwmtHeapDumpsEnabledL@RMemSpySession@@QAEXAAH@Z @ 115 NONAME ; void RMemSpySession::GetSwmtHeapDumpsEnabledL(int &)
+	?AddressOfOwningThread@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 116 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfOwningThread(void)
+	?ThreadPriority@CMemSpyApiThread@@QBE?AW4TThreadPriority@@XZ @ 117 NONAME ; enum TThreadPriority CMemSpyApiThread::ThreadPriority(void) const
+	?GetHeap@RMemSpySession@@QAEPAVCMemSpyApiHeap@@XZ @ 118 NONAME ; class CMemSpyApiHeap * RMemSpySession::GetHeap(void)
+	?Id@CMemSpyApiEComInterface@@QBE?AVTUid@@XZ @ 119 NONAME ; class TUid CMemSpyApiEComInterface::Id(void) const
+	?Caption@CMemSpyApiWindowGroup@@QBEABVTDesC16@@XZ @ 120 NONAME ; class TDesC16 const & CMemSpyApiWindowGroup::Caption(void) const
+	??1CMemSpyApiMemoryTrackingCycle@@QAE@XZ @ 121 NONAME ; CMemSpyApiMemoryTrackingCycle::~CMemSpyApiMemoryTrackingCycle(void)
+	?AccessCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 122 NONAME ; int CMemSpyApiKernelObjectItem::AccessCount(void) const
+	?ChangeCount@CMemSpyApiMemoryTrackingCycle@@QBEHXZ @ 123 NONAME ; int CMemSpyApiMemoryTrackingCycle::ChangeCount(void) const
+	?OutputHeapInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 124 NONAME ; void RMemSpySession::OutputHeapInfo(class TRequestStatus &)
+	?Time@CMemSpyApiMemoryTrackingCycle@@QBEABVTTime@@XZ @ 125 NONAME ; class TTime const & CMemSpyApiMemoryTrackingCycle::Time(void) const
+	?SetSwmtTimerIntervalL@RMemSpySession@@QAEXH@Z @ 126 NONAME ; void RMemSpySession::SetSwmtTimerIntervalL(int)
+	?OutputKernelHeapData@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 127 NONAME ; void RMemSpySession::OutputKernelHeapData(class TRequestStatus &)
+	?Id@CMemSpyApiWindowGroup@@QBEHXZ @ 128 NONAME ; int CMemSpyApiWindowGroup::Id(void) const
+	?MaxLength@CMemSpyApiHeap@@QAEHXZ @ 129 NONAME ; int CMemSpyApiHeap::MaxLength(void)
+	?AddressOfKernelOwner@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 130 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfKernelOwner(void)
+	?RomBased@CMemSpyApiEComImplementation@@QBEHXZ @ 131 NONAME ; int CMemSpyApiEComImplementation::RomBased(void) const
+	??1CMemSpyApiThreadInfoItem@@QAE@XZ @ 132 NONAME ; CMemSpyApiThreadInfoItem::~CMemSpyApiThreadInfoItem(void)
+	?FreeCount@CMemSpyApiHeap@@QAEHXZ @ 133 NONAME ; int CMemSpyApiHeap::FreeCount(void)
+	?RomOnly@CMemSpyApiEComImplementation@@QBEHXZ @ 134 NONAME ; int CMemSpyApiEComImplementation::RomOnly(void) const
+	?TotalFree@CMemSpyApiHeap@@QAEHXZ @ 135 NONAME ; int CMemSpyApiHeap::TotalFree(void)
+	?SwitchToThread@RMemSpySession@@QAEHVTThreadId@@H@Z @ 136 NONAME ; int RMemSpySession::SwitchToThread(class TThreadId, int)
+	?GetServersL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiServer@@@@W4TSortType@@@Z @ 137 NONAME ; void RMemSpySession::GetServersL(class RArray<class CMemSpyApiServer *> &, enum TSortType)
+	?FreeOverhead@CMemSpyApiHeap@@QAEHXZ @ 138 NONAME ; int CMemSpyApiHeap::FreeOverhead(void)
+	?SwitchOutputToTraceL@RMemSpySession@@QAEXXZ @ 139 NONAME ; void RMemSpySession::SwitchOutputToTraceL(void)
+	?SlackFreeSpace@CMemSpyApiHeap@@QAEHXZ @ 140 NONAME ; int CMemSpyApiHeap::SlackFreeSpace(void)
+	?Priority@CMemSpyApiKernelObjectItem@@QBEHXZ @ 141 NONAME ; int CMemSpyApiKernelObjectItem::Priority(void) const
+	?ForceSwmtUpdateL@RMemSpySession@@QAEXXZ @ 142 NONAME ; void RMemSpySession::ForceSwmtUpdateL(void)
+	?ThreadCount@CMemSpyApiProcess@@QBEHXZ @ 143 NONAME ; int CMemSpyApiProcess::ThreadCount(void) const
+	?RequestCount@CMemSpyApiThread@@QBEHXZ @ 144 NONAME ; int CMemSpyApiThread::RequestCount(void) const
+	?Caption@CMemSpyApiMemoryTrackingCycle@@QBEABVTDesC16@@XZ @ 145 NONAME ; class TDesC16 const & CMemSpyApiMemoryTrackingCycle::Caption(void) const
+	?StopSwmtTimerL@RMemSpySession@@QAEXXZ @ 146 NONAME ; void RMemSpySession::StopSwmtTimerL(void)
+	??1CMemSpyApiProcess@@QAE@XZ @ 147 NONAME ; CMemSpyApiProcess::~CMemSpyApiProcess(void)
+	?MinLength@CMemSpyApiHeap@@QAEHXZ @ 148 NONAME ; int CMemSpyApiHeap::MinLength(void)
+	?ExitCategory@CMemSpyApiProcess@@QBE?AV?$TBuf@$0BA@@@XZ @ 149 NONAME ; class TBuf<16> CMemSpyApiProcess::ExitCategory(void) const
+	?Progress@TMemSpyDeviceWideOperationProgress@@QBEHXZ @ 150 NONAME ; int TMemSpyDeviceWideOperationProgress::Progress(void) const
+	?Count@CMemSpyApiKernelObject@@QBEHXZ @ 151 NONAME ; int CMemSpyApiKernelObject::Count(void) const
+	?IsDead@CMemSpyApiProcess@@QBEHXZ @ 152 NONAME ; int CMemSpyApiProcess::IsDead(void) const
+	?EndThreadL@RMemSpySession@@QAEHVTThreadId@@W4TMemSpyEndType@@@Z @ 153 NONAME ; int RMemSpySession::EndThreadL(class TThreadId, enum TMemSpyEndType)
+	?OrdinalPosition@CMemSpyApiWindowGroup@@QBEHXZ @ 154 NONAME ; int CMemSpyApiWindowGroup::OrdinalPosition(void) const
+	?StartPos@CMemSpyApiKernelObjectItem@@QBEHXZ @ 155 NONAME ; int CMemSpyApiKernelObjectItem::StartPos(void) const
+	?TimerState@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverTimerState@@XZ @ 156 NONAME ; enum TMemSpyDriverTimerState CMemSpyApiKernelObjectItem::TimerState(void) const
+	?GetEComInterfacesL@RMemSpySession@@QAEXVTUid@@AAV?$RArray@PAVCMemSpyApiEComInterface@@@@@Z @ 157 NONAME ; void RMemSpySession::GetEComInterfacesL(class TUid, class RArray<class CMemSpyApiEComInterface *> &)
+	?BaseAddress@CMemSpyApiHeap@@QAEHXZ @ 158 NONAME ; int CMemSpyApiHeap::BaseAddress(void)
+	?ExitType@CMemSpyApiThread@@QBE?AW4TExitType@@XZ @ 159 NONAME ; enum TExitType CMemSpyApiThread::ExitType(void) const
+	?StartSwmtTimerL@RMemSpySession@@QAEXH@Z @ 160 NONAME ; void RMemSpySession::StartSwmtTimerL(int)
+	?Type@CMemSpyApiHeap@@QAEAAVTDesC16@@XZ @ 161 NONAME ; class TDesC16 & CMemSpyApiHeap::Type(void)
+	?GetOutputSink@RMemSpySession@@QAEXAAW4TMemSpySinkType@@@Z @ 162 NONAME ; void RMemSpySession::GetOutputSink(enum TMemSpySinkType &)
+	?Id@CMemSpyApiProcess@@QBE?AVTProcessId@@XZ @ 163 NONAME ; class TProcessId CMemSpyApiProcess::Id(void) const
+	?BiggestAllocation@CMemSpyApiHeap@@QAEHXZ @ 164 NONAME ; int CMemSpyApiHeap::BiggestAllocation(void)
+	??1CMemSpyApiKernelObjectItem@@QAE@XZ @ 165 NONAME ; CMemSpyApiKernelObjectItem::~CMemSpyApiKernelObjectItem(void)
+	?AllocationOverhead@CMemSpyApiHeap@@QAEHXZ @ 166 NONAME ; int CMemSpyApiHeap::AllocationOverhead(void)
+	?OutputKernelObjectsL@RMemSpySession@@QAEXXZ @ 167 NONAME ; void RMemSpySession::OutputKernelObjectsL(void)
+	?NameOfOwner@CMemSpyApiKernelObjectItem@@QBEABVTDesC8@@XZ @ 168 NONAME ; class TDesC8 const & CMemSpyApiKernelObjectItem::NameOfOwner(void) const
+	?OutputAllContainerContents@RMemSpySession@@QAEXXZ @ 169 NONAME ; void RMemSpySession::OutputAllContainerContents(void)
+	?ThreadSystemPermanentOrCritical@RMemSpySession@@QAEHVTThreadId@@H@Z @ 170 NONAME ; int RMemSpySession::ThreadSystemPermanentOrCritical(class TThreadId, int)
+	?Uid@CMemSpyApiWindowGroup@@QBE?AVTUid@@XZ @ 171 NONAME ; class TUid CMemSpyApiWindowGroup::Uid(void) const
+	?Protection@CMemSpyApiKernelObjectItem@@QBEIXZ @ 172 NONAME ; unsigned int CMemSpyApiKernelObjectItem::Protection(void) const
+	?BiggestFree@CMemSpyApiHeap@@QAEHXZ @ 173 NONAME ; int CMemSpyApiHeap::BiggestFree(void)
+	?Attributes@CMemSpyApiThread@@QBEHXZ @ 174 NONAME ; int CMemSpyApiThread::Attributes(void) const
+	?GetSwmtCyclesCount@RMemSpySession@@QAEHXZ @ 175 NONAME ; int RMemSpySession::GetSwmtCyclesCount(void)
+	?Bottom@CMemSpyApiKernelObjectItem@@QBEHXZ @ 176 NONAME ; int CMemSpyApiKernelObjectItem::Bottom(void) const
+	?StartSwmtTimerL@RMemSpySession@@QAEXXZ @ 177 NONAME ; void RMemSpySession::StartSwmtTimerL(void)
+	?EndProcessL@RMemSpySession@@QAEHVTProcessId@@W4TMemSpyEndType@@@Z @ 178 NONAME ; int RMemSpySession::EndProcessL(class TProcessId, enum TMemSpyEndType)
+	?GetKernelObjectItemsL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiKernelObjectItem@@@@W4TMemSpyDriverContainerType@@@Z @ 179 NONAME ; void RMemSpySession::GetKernelObjectItemsL(class RArray<class CMemSpyApiKernelObjectItem *> &, enum TMemSpyDriverContainerType)
+	?OutputPhoneInfo@RMemSpySession@@QAEXXZ @ 180 NONAME ; void RMemSpySession::OutputPhoneInfo(void)
+	?IsBusy@CMemSpyApiWindowGroup@@QBEHXZ @ 181 NONAME ; int CMemSpyApiWindowGroup::IsBusy(void) const
+	?NotifyDeviceWideOperationProgress@RMemSpySession@@QAEXAAVTMemSpyDeviceWideOperationProgress@@AAVTRequestStatus@@@Z @ 182 NONAME ; void RMemSpySession::NotifyDeviceWideOperationProgress(class TMemSpyDeviceWideOperationProgress &, class TRequestStatus &)
+	?OutputCompactHeapInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 183 NONAME ; void RMemSpySession::OutputCompactHeapInfo(class TRequestStatus &)
+	?ThreadHandles@CMemSpyApiThread@@QBEHXZ @ 184 NONAME ; int CMemSpyApiThread::ThreadHandles(void) const
+	?SvrSessionType@CMemSpyApiKernelObjectItem@@QBEEXZ @ 185 NONAME ; unsigned char CMemSpyApiKernelObjectItem::SvrSessionType(void) const
+	?IsSystem@CMemSpyApiWindowGroup@@QBEHXZ @ 186 NONAME ; int CMemSpyApiWindowGroup::IsSystem(void) const
+	?SwitchOutputSinkL@RMemSpySession@@QAEXW4TMemSpySinkType@@@Z @ 187 NONAME ; void RMemSpySession::SwitchOutputSinkL(enum TMemSpySinkType)
+	?ChunkType@CMemSpyApiKernelObjectItem@@QBEIXZ @ 188 NONAME ; unsigned int CMemSpyApiKernelObjectItem::ChunkType(void) const
+	?GetSwmtMode@RMemSpySession@@QAEXAAW4TMemSpyEngineSysMemTrackerMode@TMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 189 NONAME ; void RMemSpySession::GetSwmtMode(enum TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode &)
+	?WindowGroupHandle@CMemSpyApiWindowGroup@@QBEHXZ @ 190 NONAME ; int CMemSpyApiWindowGroup::WindowGroupHandle(void) const
+	?OutputPhoneInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 191 NONAME ; void RMemSpySession::OutputPhoneInfo(class TRequestStatus &)
+	?Id@CMemSpyApiThread@@QBE?AVTThreadId@@XZ @ 192 NONAME ; class TThreadId CMemSpyApiThread::Id(void) const
+	?GetMemoryTrackingCyclesL@RMemSpySession@@QAEXAAV?$RArray@PAVCMemSpyApiMemoryTrackingCycle@@@@@Z @ 193 NONAME ; void RMemSpySession::GetMemoryTrackingCyclesL(class RArray<class CMemSpyApiMemoryTrackingCycle *> &)
+	?GetProcessIdByNameL@RMemSpySession@@QAE?AVTProcessId@@ABVTDesC16@@@Z @ 194 NONAME ; class TProcessId RMemSpySession::GetProcessIdByNameL(class TDesC16 const &)
+	?MapAttr@CMemSpyApiKernelObjectItem@@QBEIXZ @ 195 NONAME ; unsigned int CMemSpyApiKernelObjectItem::MapAttr(void) const
+	?OutputCompactStackInfo@RMemSpySession@@QAEXAAVTRequestStatus@@@Z @ 196 NONAME ; void RMemSpySession::OutputCompactStackInfo(class TRequestStatus &)
+	?VID@CMemSpyApiProcess@@QBEKXZ @ 197 NONAME ; unsigned long CMemSpyApiProcess::VID(void) const
+	?AddressOfCodeSeg@CMemSpyApiKernelObjectItem@@QAEPAEXZ @ 198 NONAME ; unsigned char * CMemSpyApiKernelObjectItem::AddressOfCodeSeg(void)
+	?ThreadId@CMemSpyApiServer@@QBE?AVTThreadId@@XZ @ 199 NONAME ; class TThreadId CMemSpyApiServer::ThreadId(void) const
+	?GetThreadsL@RMemSpySession@@QAEXVTProcessId@@AAV?$RArray@PAVCMemSpyApiThread@@@@W4TSortType@@@Z @ 200 NONAME ; void RMemSpySession::GetThreadsL(class TProcessId, class RArray<class CMemSpyApiThread *> &, enum TSortType)
+	?ProcessId@CMemSpyApiThread@@QBE?AVTProcessId@@XZ @ 201 NONAME ; class TProcessId CMemSpyApiThread::ProcessId(void) const
+	?Type@CMemSpyApiKernelObjectItem@@QBE?AW4TMemSpyDriverContainerType@@XZ @ 202 NONAME ; enum TMemSpyDriverContainerType CMemSpyApiKernelObjectItem::Type(void) const
+	?ImplementationCount@CMemSpyApiEComInterface@@QBEHXZ @ 203 NONAME ; int CMemSpyApiEComInterface::ImplementationCount(void) const
+	?FullName@CMemSpyApiWindowGroup@@QBEABVTDesC16@@XZ @ 204 NONAME ; class TDesC16 const & CMemSpyApiWindowGroup::FullName(void) const
+	?ChunkSize@CMemSpyApiHeap@@QAEHXZ @ 205 NONAME ; int CMemSpyApiHeap::ChunkSize(void)
+	??1CMemSpyApiEComInterface@@UAE@XZ @ 206 NONAME ; CMemSpyApiEComInterface::~CMemSpyApiEComInterface(void)
+	?UnitsMask@CMemSpyApiKernelObjectItem@@QBEIXZ @ 207 NONAME ; unsigned int CMemSpyApiKernelObjectItem::UnitsMask(void) const
+	?Name@CMemSpyApiEComInterface@@QBEABVTDesC16@@XZ @ 208 NONAME ; class TDesC16 const & CMemSpyApiEComInterface::Name(void) const
+	?Disabled@CMemSpyApiEComImplementation@@QBEHXZ @ 209 NONAME ; int CMemSpyApiEComImplementation::Disabled(void) const
+	?Name@CMemSpyApiServer@@QBEABVTDesC16@@XZ @ 210 NONAME ; class TDesC16 const & CMemSpyApiServer::Name(void) const
+	?State@CMemSpyApiKernelObjectItem@@QBEEXZ @ 211 NONAME ; unsigned char CMemSpyApiKernelObjectItem::State(void) const
+	?Shared@CMemSpyApiHeap@@QAEHXZ @ 212 NONAME ; int CMemSpyApiHeap::Shared(void)
+	?SetSwmtAutoStartProcessList@RMemSpySession@@QAEXPAV?$CArrayFixFlat@VTUid@@@@@Z @ 213 NONAME ; void RMemSpySession::SetSwmtAutoStartProcessList(class CArrayFixFlat<class TUid> *)
+	?OutputCompactHeapInfoL@RMemSpySession@@QAEXXZ @ 214 NONAME ; void RMemSpySession::OutputCompactHeapInfoL(void)
+	?ProcessSystemPermanentOrCritical@RMemSpySession@@QAEHVTProcessId@@H@Z @ 215 NONAME ; int RMemSpySession::ProcessSystemPermanentOrCritical(class TProcessId, int)
+	??1CMemSpyApiServer@@QAE@XZ @ 216 NONAME ; CMemSpyApiServer::~CMemSpyApiServer(void)
+	?SetSwmtMode@RMemSpySession@@QAEXW4TMemSpyEngineSysMemTrackerMode@TMemSpyEngineHelperSysMemTrackerConfig@@@Z @ 217 NONAME ; void RMemSpySession::SetSwmtMode(enum TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode)
+	?OutputKernelHeapDataL@RMemSpySession@@QAEXXZ @ 218 NONAME ; void RMemSpySession::OutputKernelHeapDataL(void)
+	??1CMemSpyApiWindowGroup@@UAE@XZ @ 219 NONAME ; CMemSpyApiWindowGroup::~CMemSpyApiWindowGroup(void)
+	?MapCount@CMemSpyApiKernelObjectItem@@QBEHXZ @ 220 NONAME ; int CMemSpyApiKernelObjectItem::MapCount(void) const
+	?OpenChannels@CMemSpyApiKernelObjectItem@@QAEHXZ @ 221 NONAME ; int CMemSpyApiKernelObjectItem::OpenChannels(void)
+	?ProcessPriority@CMemSpyApiThread@@QBE?AW4TProcessPriority@@XZ @ 222 NONAME ; enum TProcessPriority CMemSpyApiThread::ProcessPriority(void) const
+	?IsFocused@CMemSpyApiWindowGroup@@QBEHXZ @ 223 NONAME ; int CMemSpyApiWindowGroup::IsFocused(void) const
+	?OutputAOListL@RMemSpySession@@QAEXVTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 224 NONAME ; void RMemSpySession::OutputAOListL(class TThreadId, enum TMemSpyThreadInfoItemType)
+	?ThreadNumberUsing@CMemSpyApiThread@@QBEHXZ @ 225 NONAME ; int CMemSpyApiThread::ThreadNumberUsing(void) const
+	?OutputThreadCellListL@RMemSpySession@@QAEXVTThreadId@@@Z @ 226 NONAME ; void RMemSpySession::OutputThreadCellListL(class TThreadId)
+	?OutputHeapInfoUserL@RMemSpySession@@QAEXVTThreadId@@@Z @ 227 NONAME ; void RMemSpySession::OutputHeapInfoUserL(class TThreadId)
+	?SessionCount@CMemSpyApiServer@@QBEHXZ @ 228 NONAME ; int CMemSpyApiServer::SessionCount(void) const
+	?Connect@RMemSpySession@@QAEHXZ @ 229 NONAME ; int RMemSpySession::Connect(void)
+	??1CMemSpyApiThread@@QAE@XZ @ 230 NONAME ; CMemSpyApiThread::~CMemSpyApiThread(void)
+	?GetThreadInfoItems@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiThreadInfoItem@@@@VTThreadId@@W4TMemSpyThreadInfoItemType@@@Z @ 231 NONAME ; int RMemSpySession::GetThreadInfoItems(class RArray<class CMemSpyApiThreadInfoItem *> &, class TThreadId, enum TMemSpyThreadInfoItemType)
+	?SID@CMemSpyApiThread@@QBEHXZ @ 232 NONAME ; int CMemSpyApiThread::SID(void) const
+	?GetKernelObjectItems@RMemSpySession@@QAEHAAV?$RArray@PAVCMemSpyApiKernelObjectItem@@@@W4TMemSpyDriverContainerType@@@Z @ 233 NONAME ; int RMemSpySession::GetKernelObjectItems(class RArray<class CMemSpyApiKernelObjectItem *> &, enum TMemSpyDriverContainerType)
+	?Name@CMemSpyApiWindowGroup@@QBEABVTDesC16@@XZ @ 234 NONAME ; class TDesC16 const & CMemSpyApiWindowGroup::Name(void) const
+	?ProcessHandles@CMemSpyApiThread@@QBEHXZ @ 235 NONAME ; int CMemSpyApiThread::ProcessHandles(void) const
+	?Name@CMemSpyApiThread@@QBEABVTDesC16@@XZ @ 236 NONAME ; class TDesC16 const & CMemSpyApiThread::Name(void) const
 
--- a/perfsrv/memspy/MemSpyClient/eabi/MemSpyClientu.def	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/eabi/MemSpyClientu.def	Mon Oct 04 02:45:59 2010 +0300
@@ -52,185 +52,204 @@
 	_ZN14RMemSpySession15SwitchToProcessE10TProcessIdi @ 51 NONAME
 	_ZN14RMemSpySession16ForceSwmtUpdateLEv @ 52 NONAME
 	_ZN14RMemSpySession16GetKernelObjectsER6RArrayIP22CMemSpyApiKernelObjectE @ 53 NONAME
-	_ZN14RMemSpySession16OutputStackDataLE9TThreadId23TMemSpyDriverDomainType @ 54 NONAME
-	_ZN14RMemSpySession16OutputStackInfoLE9TThreadId @ 55 NONAME
-	_ZN14RMemSpySession17GetKernelObjectsLER6RArrayIP22CMemSpyApiKernelObjectE @ 56 NONAME
-	_ZN14RMemSpySession17SwitchOutputSinkLE15TMemSpySinkType @ 57 NONAME
-	_ZN14RMemSpySession17SwmtResetTrackingEv @ 58 NONAME
-	_ZN14RMemSpySession18GetEComCategoriesLER6RArrayIP22CMemSpyApiEComCategoryE @ 59 NONAME
-	_ZN14RMemSpySession18GetEComInterfacesLE4TUidR6RArrayIP23CMemSpyApiEComInterfaceE @ 60 NONAME
-	_ZN14RMemSpySession18GetSwmtCategoriesLERi @ 61 NONAME
-	_ZN14RMemSpySession18GetSwmtCyclesCountEv @ 62 NONAME
-	_ZN14RMemSpySession18GetThreadInfoItemsER6RArrayIP24CMemSpyApiThreadInfoItemE9TThreadId25TMemSpyThreadInfoItemType @ 63 NONAME
-	_ZN14RMemSpySession18SetSwmtCategoriesLEi @ 64 NONAME
-	_ZN14RMemSpySession18SetThreadPriorityLE9TThreadIdi @ 65 NONAME
-	_ZN14RMemSpySession19GetProcessIdByNameLERK7TDesC16 @ 66 NONAME
-	_ZN14RMemSpySession19GetThreadInfoItemsLER6RArrayIP24CMemSpyApiThreadInfoItemE9TThreadId25TMemSpyThreadInfoItemType @ 67 NONAME
-	_ZN14RMemSpySession19OutputHeapInfoUserLE9TThreadId @ 68 NONAME
-	_ZN14RMemSpySession19OutputUserStackDataER14TRequestStatus @ 69 NONAME
-	_ZN14RMemSpySession19SwitchOutputToFileLERK7TDesC16 @ 70 NONAME
-	_ZN14RMemSpySession20GetKernelObjectItemsER6RArrayIP26CMemSpyApiKernelObjectItemE26TMemSpyDriverContainerType @ 71 NONAME
-	_ZN14RMemSpySession20OutputKernelHeapDataER14TRequestStatus @ 72 NONAME
-	_ZN14RMemSpySession20OutputKernelObjectsLEv @ 73 NONAME
-	_ZN14RMemSpySession20SwitchOutputToTraceLEv @ 74 NONAME
-	_ZN14RMemSpySession21GetKernelObjectItemsLER6RArrayIP26CMemSpyApiKernelObjectItemE26TMemSpyDriverContainerType @ 75 NONAME
-	_ZN14RMemSpySession21GetSwmtTimerIntervalLERi @ 76 NONAME
-	_ZN14RMemSpySession21OutputCompactHeapInfoER14TRequestStatus @ 77 NONAME
-	_ZN14RMemSpySession21OutputHeapCellListingER14TRequestStatus @ 78 NONAME
-	_ZN14RMemSpySession21OutputKernelHeapDataLEv @ 79 NONAME
-	_ZN14RMemSpySession21OutputKernelStackDataER14TRequestStatus @ 80 NONAME
-	_ZN14RMemSpySession21OutputThreadCellListLE9TThreadId @ 81 NONAME
-	_ZN14RMemSpySession21OutputThreadHeapDataLE9TThreadId @ 82 NONAME
-	_ZN14RMemSpySession21OutputThreadHeapDataLERK7TDesC16 @ 83 NONAME
-	_ZN14RMemSpySession21SetSwmtTimerIntervalLEi @ 84 NONAME
-	_ZN14RMemSpySession22GetProcessIdByThreadIdER10TProcessId9TThreadId @ 85 NONAME
-	_ZN14RMemSpySession22OutputCompactHeapInfoLEv @ 86 NONAME
-	_ZN14RMemSpySession22OutputCompactStackInfoER14TRequestStatus @ 87 NONAME
-	_ZN14RMemSpySession23GetEComImplementationsLE4TUidR6RArrayIP28CMemSpyApiEComImplementationE @ 88 NONAME
-	_ZN14RMemSpySession23OutputCompactStackInfoLEv @ 89 NONAME
-	_ZN14RMemSpySession23OutputDetailedPhoneInfoER14TRequestStatus @ 90 NONAME
-	_ZN14RMemSpySession24GetMemoryTrackingCyclesLER6RArrayIP29CMemSpyApiMemoryTrackingCycleE @ 91 NONAME
-	_ZN14RMemSpySession24GetSwmtHeapDumpsEnabledLERi @ 92 NONAME
-	_ZN14RMemSpySession24OutputThreadInfoHandlesLE9TThreadId @ 93 NONAME
-	_ZN14RMemSpySession24ServerListOutputGenericLEi @ 94 NONAME
-	_ZN14RMemSpySession24SetSwmtHeapDumpsEnabledLEi @ 95 NONAME
-	_ZN14RMemSpySession26CancelDeviceWideOperationLEv @ 96 NONAME
-	_ZN14RMemSpySession26OutputAllContainerContentsEv @ 97 NONAME
-	_ZN14RMemSpySession27SetSwmtAutoStartProcessListEP13CArrayFixFlatI4TUidE @ 98 NONAME
-	_ZN14RMemSpySession31ThreadSystemPermanentOrCriticalE9TThreadIdi @ 99 NONAME
-	_ZN14RMemSpySession32ProcessSystemPermanentOrCriticalE10TProcessIdi @ 100 NONAME
-	_ZN14RMemSpySession33NotifyDeviceWideOperationProgressER34TMemSpyDeviceWideOperationProgressR14TRequestStatus @ 101 NONAME
-	_ZN14RMemSpySession7ConnectEv @ 102 NONAME
-	_ZN14RMemSpySession7GetHeapEv @ 103 NONAME
-	_ZN14RMemSpySession8GetHeapLEv @ 104 NONAME
-	_ZN14RMemSpySessionC1Ev @ 105 NONAME
-	_ZN14RMemSpySessionC2Ev @ 106 NONAME
-	_ZN16CMemSpyApiServerD1Ev @ 107 NONAME
-	_ZN16CMemSpyApiServerD2Ev @ 108 NONAME
-	_ZN16CMemSpyApiThreadD1Ev @ 109 NONAME
-	_ZN16CMemSpyApiThreadD2Ev @ 110 NONAME
-	_ZN17CMemSpyApiProcessD1Ev @ 111 NONAME
-	_ZN17CMemSpyApiProcessD2Ev @ 112 NONAME
-	_ZN22CMemSpyApiEComCategoryD0Ev @ 113 NONAME
-	_ZN22CMemSpyApiEComCategoryD1Ev @ 114 NONAME
-	_ZN22CMemSpyApiEComCategoryD2Ev @ 115 NONAME
-	_ZN22CMemSpyApiKernelObjectD1Ev @ 116 NONAME
-	_ZN22CMemSpyApiKernelObjectD2Ev @ 117 NONAME
-	_ZN23CMemSpyApiEComInterfaceD0Ev @ 118 NONAME
-	_ZN23CMemSpyApiEComInterfaceD1Ev @ 119 NONAME
-	_ZN23CMemSpyApiEComInterfaceD2Ev @ 120 NONAME
-	_ZN24CMemSpyApiThreadInfoItemD1Ev @ 121 NONAME
-	_ZN24CMemSpyApiThreadInfoItemD2Ev @ 122 NONAME
-	_ZN26CMemSpyApiKernelObjectItem12OpenChannelsEv @ 123 NONAME
-	_ZN26CMemSpyApiKernelObjectItem15AddressOfServerEv @ 124 NONAME
-	_ZN26CMemSpyApiKernelObjectItem16AddressOfCodeSegEv @ 125 NONAME
-	_ZN26CMemSpyApiKernelObjectItem20AddressOfKernelOwnerEv @ 126 NONAME
-	_ZN26CMemSpyApiKernelObjectItem21AddressOfOwningThreadEv @ 127 NONAME
-	_ZN26CMemSpyApiKernelObjectItem22AddressOfOwningProcessEv @ 128 NONAME
-	_ZN26CMemSpyApiKernelObjectItem26AddressOfDataBssStackChunkEv @ 129 NONAME
-	_ZN26CMemSpyApiKernelObjectItemD1Ev @ 130 NONAME
-	_ZN26CMemSpyApiKernelObjectItemD2Ev @ 131 NONAME
-	_ZN28CMemSpyApiEComImplementationD0Ev @ 132 NONAME
-	_ZN28CMemSpyApiEComImplementationD1Ev @ 133 NONAME
-	_ZN28CMemSpyApiEComImplementationD2Ev @ 134 NONAME
-	_ZN29CMemSpyApiMemoryTrackingCycleD1Ev @ 135 NONAME
-	_ZN29CMemSpyApiMemoryTrackingCycleD2Ev @ 136 NONAME
-	_ZNK16CMemSpyApiServer12SessionCountEv @ 137 NONAME
-	_ZNK16CMemSpyApiServer2IdEv @ 138 NONAME
-	_ZNK16CMemSpyApiServer4NameEv @ 139 NONAME
-	_ZNK16CMemSpyApiThread10AttributesEv @ 140 NONAME
-	_ZNK16CMemSpyApiThread12RequestCountEv @ 141 NONAME
-	_ZNK16CMemSpyApiThread13ThreadHandlesEv @ 142 NONAME
-	_ZNK16CMemSpyApiThread14ProcessHandlesEv @ 143 NONAME
-	_ZNK16CMemSpyApiThread14ThreadPriorityEv @ 144 NONAME
-	_ZNK16CMemSpyApiThread15ProcessPriorityEv @ 145 NONAME
-	_ZNK16CMemSpyApiThread17ThreadNumberUsingEv @ 146 NONAME
-	_ZNK16CMemSpyApiThread18ProcessNumberUsingEv @ 147 NONAME
-	_ZNK16CMemSpyApiThread2IdEv @ 148 NONAME
-	_ZNK16CMemSpyApiThread3SIDEv @ 149 NONAME
-	_ZNK16CMemSpyApiThread3VIDEv @ 150 NONAME
-	_ZNK16CMemSpyApiThread4NameEv @ 151 NONAME
-	_ZNK16CMemSpyApiThread6CpuUseEv @ 152 NONAME
-	_ZNK16CMemSpyApiThread8ExitTypeEv @ 153 NONAME
-	_ZNK16CMemSpyApiThread9ProcessIdEv @ 154 NONAME
-	_ZNK17CMemSpyApiProcess10ExitReasonEv @ 155 NONAME
-	_ZNK17CMemSpyApiProcess11ThreadCountEv @ 156 NONAME
-	_ZNK17CMemSpyApiProcess12ExitCategoryEv @ 157 NONAME
-	_ZNK17CMemSpyApiProcess2IdEv @ 158 NONAME
-	_ZNK17CMemSpyApiProcess3SIDEv @ 159 NONAME
-	_ZNK17CMemSpyApiProcess3VIDEv @ 160 NONAME
-	_ZNK17CMemSpyApiProcess4NameEv @ 161 NONAME
-	_ZNK17CMemSpyApiProcess6IsDeadEv @ 162 NONAME
-	_ZNK17CMemSpyApiProcess8ExitTypeEv @ 163 NONAME
-	_ZNK17CMemSpyApiProcess8PriorityEv @ 164 NONAME
-	_ZNK22CMemSpyApiEComCategory14InterfaceCountEv @ 165 NONAME
-	_ZNK22CMemSpyApiEComCategory2IdEv @ 166 NONAME
-	_ZNK22CMemSpyApiEComCategory4NameEv @ 167 NONAME
-	_ZNK22CMemSpyApiKernelObject4NameEv @ 168 NONAME
-	_ZNK22CMemSpyApiKernelObject4SizeEv @ 169 NONAME
-	_ZNK22CMemSpyApiKernelObject4TypeEv @ 170 NONAME
-	_ZNK22CMemSpyApiKernelObject5CountEv @ 171 NONAME
-	_ZNK23CMemSpyApiEComInterface19ImplementationCountEv @ 172 NONAME
-	_ZNK23CMemSpyApiEComInterface2IdEv @ 173 NONAME
-	_ZNK23CMemSpyApiEComInterface4NameEv @ 174 NONAME
-	_ZNK24CMemSpyApiThreadInfoItem5ValueEv @ 175 NONAME
-	_ZNK24CMemSpyApiThreadInfoItem7CaptionEv @ 176 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10AttributesEv @ 177 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10NameDetailEv @ 178 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10ProtectionEv @ 179 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem10TimerStateEv @ 180 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem11AccessCountEv @ 181 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem11NameOfOwnerEv @ 182 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem11SessionTypeEv @ 183 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem12RestrictionsEv @ 184 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem12SecurityZoneEv @ 185 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem14SvrSessionTypeEv @ 186 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem16ControllingOwnerEv @ 187 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem16TotalAccessCountEv @ 188 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem2IdEv @ 189 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem3TopEv @ 190 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem4NameEv @ 191 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem4SizeEv @ 192 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem4TypeEv @ 193 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem5CountEv @ 194 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem5OrderEv @ 195 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem5StateEv @ 196 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem6BottomEv @ 197 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem6HandleEv @ 198 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7ChangesEv @ 199 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7MapAttrEv @ 200 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7MaxSizeEv @ 201 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem7VersionEv @ 202 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8MapCountEv @ 203 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8MsgCountEv @ 204 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8MsgLimitEv @ 205 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8PriorityEv @ 206 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8StartPosEv @ 207 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem8UniqueIDEv @ 208 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9ChunkTypeEv @ 209 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9CreatorIdEv @ 210 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9ParseMaskEv @ 211 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9ResettingEv @ 212 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9TimerTypeEv @ 213 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9UnitsMaskEv @ 214 NONAME
-	_ZNK26CMemSpyApiKernelObjectItem9WaitCountEv @ 215 NONAME
-	_ZNK28CMemSpyApiEComImplementation10OpaqueDataEv @ 216 NONAME
-	_ZNK28CMemSpyApiEComImplementation17ImplementationUidEv @ 217 NONAME
-	_ZNK28CMemSpyApiEComImplementation4NameEv @ 218 NONAME
-	_ZNK28CMemSpyApiEComImplementation5DriveEv @ 219 NONAME
-	_ZNK28CMemSpyApiEComImplementation7RomOnlyEv @ 220 NONAME
-	_ZNK28CMemSpyApiEComImplementation7VersionEv @ 221 NONAME
-	_ZNK28CMemSpyApiEComImplementation8DataTypeEv @ 222 NONAME
-	_ZNK28CMemSpyApiEComImplementation8DisabledEv @ 223 NONAME
-	_ZNK28CMemSpyApiEComImplementation8RomBasedEv @ 224 NONAME
-	_ZNK28CMemSpyApiEComImplementation8VendorIdEv @ 225 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle10FreeMemoryEv @ 226 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle11ChangeCountEv @ 227 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle11CycleNumberEv @ 228 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle11MemoryDeltaEv @ 229 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle17PreviousCycleDiffEv @ 230 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle4TimeEv @ 231 NONAME
-	_ZNK29CMemSpyApiMemoryTrackingCycle7CaptionEv @ 232 NONAME
-	_ZNK34TMemSpyDeviceWideOperationProgress11DescriptionEv @ 233 NONAME
-	_ZNK34TMemSpyDeviceWideOperationProgress8ProgressEv @ 234 NONAME
+	_ZN14RMemSpySession16GetWindowGroupsLER6RArrayIP21CMemSpyApiWindowGroupE @ 54 NONAME
+	_ZN14RMemSpySession16OutputStackDataLE9TThreadId23TMemSpyDriverDomainType @ 55 NONAME
+	_ZN14RMemSpySession16OutputStackInfoLE9TThreadId @ 56 NONAME
+	_ZN14RMemSpySession17GetKernelObjectsLER6RArrayIP22CMemSpyApiKernelObjectE @ 57 NONAME
+	_ZN14RMemSpySession17SwitchOutputSinkLE15TMemSpySinkType @ 58 NONAME
+	_ZN14RMemSpySession17SwmtResetTrackingEv @ 59 NONAME
+	_ZN14RMemSpySession18GetEComCategoriesLER6RArrayIP22CMemSpyApiEComCategoryE @ 60 NONAME
+	_ZN14RMemSpySession18GetEComInterfacesLE4TUidR6RArrayIP23CMemSpyApiEComInterfaceE @ 61 NONAME
+	_ZN14RMemSpySession18GetSwmtCategoriesLERi @ 62 NONAME
+	_ZN14RMemSpySession18GetSwmtCyclesCountEv @ 63 NONAME
+	_ZN14RMemSpySession18GetThreadInfoItemsER6RArrayIP24CMemSpyApiThreadInfoItemE9TThreadId25TMemSpyThreadInfoItemType @ 64 NONAME
+	_ZN14RMemSpySession18SetSwmtCategoriesLEi @ 65 NONAME
+	_ZN14RMemSpySession18SetThreadPriorityLE9TThreadIdi @ 66 NONAME
+	_ZN14RMemSpySession19GetProcessIdByNameLERK7TDesC16 @ 67 NONAME
+	_ZN14RMemSpySession19GetThreadInfoItemsLER6RArrayIP24CMemSpyApiThreadInfoItemE9TThreadId25TMemSpyThreadInfoItemType @ 68 NONAME
+	_ZN14RMemSpySession19OutputHeapInfoUserLE9TThreadId @ 69 NONAME
+	_ZN14RMemSpySession19OutputUserStackDataER14TRequestStatus @ 70 NONAME
+	_ZN14RMemSpySession19SwitchOutputToFileLERK7TDesC16 @ 71 NONAME
+	_ZN14RMemSpySession20GetKernelObjectItemsER6RArrayIP26CMemSpyApiKernelObjectItemE26TMemSpyDriverContainerType @ 72 NONAME
+	_ZN14RMemSpySession20OutputKernelHeapDataER14TRequestStatus @ 73 NONAME
+	_ZN14RMemSpySession20OutputKernelObjectsLEv @ 74 NONAME
+	_ZN14RMemSpySession20SwitchOutputToTraceLEv @ 75 NONAME
+	_ZN14RMemSpySession21GetKernelObjectItemsLER6RArrayIP26CMemSpyApiKernelObjectItemE26TMemSpyDriverContainerType @ 76 NONAME
+	_ZN14RMemSpySession21GetSwmtTimerIntervalLERi @ 77 NONAME
+	_ZN14RMemSpySession21OutputCompactHeapInfoER14TRequestStatus @ 78 NONAME
+	_ZN14RMemSpySession21OutputHeapCellListingER14TRequestStatus @ 79 NONAME
+	_ZN14RMemSpySession21OutputKernelHeapDataLEv @ 80 NONAME
+	_ZN14RMemSpySession21OutputKernelStackDataER14TRequestStatus @ 81 NONAME
+	_ZN14RMemSpySession21OutputThreadCellListLE9TThreadId @ 82 NONAME
+	_ZN14RMemSpySession21OutputThreadHeapDataLE9TThreadId @ 83 NONAME
+	_ZN14RMemSpySession21OutputThreadHeapDataLERK7TDesC16 @ 84 NONAME
+	_ZN14RMemSpySession21SetSwmtTimerIntervalLEi @ 85 NONAME
+	_ZN14RMemSpySession22GetProcessIdByThreadIdER10TProcessId9TThreadId @ 86 NONAME
+	_ZN14RMemSpySession22OutputCompactHeapInfoLEv @ 87 NONAME
+	_ZN14RMemSpySession22OutputCompactStackInfoER14TRequestStatus @ 88 NONAME
+	_ZN14RMemSpySession23GetEComImplementationsLE4TUidR6RArrayIP28CMemSpyApiEComImplementationE @ 89 NONAME
+	_ZN14RMemSpySession23OutputCompactStackInfoLEv @ 90 NONAME
+	_ZN14RMemSpySession23OutputDetailedPhoneInfoER14TRequestStatus @ 91 NONAME
+	_ZN14RMemSpySession24GetMemoryTrackingCyclesLER6RArrayIP29CMemSpyApiMemoryTrackingCycleE @ 92 NONAME
+	_ZN14RMemSpySession24GetSwmtHeapDumpsEnabledLERi @ 93 NONAME
+	_ZN14RMemSpySession24OutputThreadInfoHandlesLE9TThreadId @ 94 NONAME
+	_ZN14RMemSpySession24ServerListOutputGenericLEi @ 95 NONAME
+	_ZN14RMemSpySession24SetSwmtHeapDumpsEnabledLEi @ 96 NONAME
+	_ZN14RMemSpySession26CancelDeviceWideOperationLEv @ 97 NONAME
+	_ZN14RMemSpySession26OutputAllContainerContentsEv @ 98 NONAME
+	_ZN14RMemSpySession27SetSwmtAutoStartProcessListEP13CArrayFixFlatI4TUidE @ 99 NONAME
+	_ZN14RMemSpySession31ThreadSystemPermanentOrCriticalE9TThreadIdi @ 100 NONAME
+	_ZN14RMemSpySession32ProcessSystemPermanentOrCriticalE10TProcessIdi @ 101 NONAME
+	_ZN14RMemSpySession33NotifyDeviceWideOperationProgressER34TMemSpyDeviceWideOperationProgressR14TRequestStatus @ 102 NONAME
+	_ZN14RMemSpySession7ConnectEv @ 103 NONAME
+	_ZN14RMemSpySession7GetHeapEv @ 104 NONAME
+	_ZN14RMemSpySession8GetHeapLEv @ 105 NONAME
+	_ZN14RMemSpySessionC1Ev @ 106 NONAME
+	_ZN14RMemSpySessionC2Ev @ 107 NONAME
+	_ZN16CMemSpyApiServerD1Ev @ 108 NONAME
+	_ZN16CMemSpyApiServerD2Ev @ 109 NONAME
+	_ZN16CMemSpyApiThreadD1Ev @ 110 NONAME
+	_ZN16CMemSpyApiThreadD2Ev @ 111 NONAME
+	_ZN17CMemSpyApiProcessD1Ev @ 112 NONAME
+	_ZN17CMemSpyApiProcessD2Ev @ 113 NONAME
+	_ZN21CMemSpyApiWindowGroupD0Ev @ 114 NONAME
+	_ZN21CMemSpyApiWindowGroupD1Ev @ 115 NONAME
+	_ZN21CMemSpyApiWindowGroupD2Ev @ 116 NONAME
+	_ZN22CMemSpyApiEComCategoryD0Ev @ 117 NONAME
+	_ZN22CMemSpyApiEComCategoryD1Ev @ 118 NONAME
+	_ZN22CMemSpyApiEComCategoryD2Ev @ 119 NONAME
+	_ZN22CMemSpyApiKernelObjectD1Ev @ 120 NONAME
+	_ZN22CMemSpyApiKernelObjectD2Ev @ 121 NONAME
+	_ZN23CMemSpyApiEComInterfaceD0Ev @ 122 NONAME
+	_ZN23CMemSpyApiEComInterfaceD1Ev @ 123 NONAME
+	_ZN23CMemSpyApiEComInterfaceD2Ev @ 124 NONAME
+	_ZN24CMemSpyApiThreadInfoItemD1Ev @ 125 NONAME
+	_ZN24CMemSpyApiThreadInfoItemD2Ev @ 126 NONAME
+	_ZN26CMemSpyApiKernelObjectItem12OpenChannelsEv @ 127 NONAME
+	_ZN26CMemSpyApiKernelObjectItem15AddressOfServerEv @ 128 NONAME
+	_ZN26CMemSpyApiKernelObjectItem16AddressOfCodeSegEv @ 129 NONAME
+	_ZN26CMemSpyApiKernelObjectItem20AddressOfKernelOwnerEv @ 130 NONAME
+	_ZN26CMemSpyApiKernelObjectItem21AddressOfOwningThreadEv @ 131 NONAME
+	_ZN26CMemSpyApiKernelObjectItem22AddressOfOwningProcessEv @ 132 NONAME
+	_ZN26CMemSpyApiKernelObjectItem26AddressOfDataBssStackChunkEv @ 133 NONAME
+	_ZN26CMemSpyApiKernelObjectItemD1Ev @ 134 NONAME
+	_ZN26CMemSpyApiKernelObjectItemD2Ev @ 135 NONAME
+	_ZN28CMemSpyApiEComImplementationD0Ev @ 136 NONAME
+	_ZN28CMemSpyApiEComImplementationD1Ev @ 137 NONAME
+	_ZN28CMemSpyApiEComImplementationD2Ev @ 138 NONAME
+	_ZN29CMemSpyApiMemoryTrackingCycleD1Ev @ 139 NONAME
+	_ZN29CMemSpyApiMemoryTrackingCycleD2Ev @ 140 NONAME
+	_ZNK16CMemSpyApiServer12SessionCountEv @ 141 NONAME
+	_ZNK16CMemSpyApiServer4NameEv @ 142 NONAME
+	_ZNK16CMemSpyApiServer8ThreadIdEv @ 143 NONAME
+	_ZNK16CMemSpyApiServer9ProcessIdEv @ 144 NONAME
+	_ZNK16CMemSpyApiThread10AttributesEv @ 145 NONAME
+	_ZNK16CMemSpyApiThread12RequestCountEv @ 146 NONAME
+	_ZNK16CMemSpyApiThread13ThreadHandlesEv @ 147 NONAME
+	_ZNK16CMemSpyApiThread14ProcessHandlesEv @ 148 NONAME
+	_ZNK16CMemSpyApiThread14ThreadPriorityEv @ 149 NONAME
+	_ZNK16CMemSpyApiThread15ProcessPriorityEv @ 150 NONAME
+	_ZNK16CMemSpyApiThread17ThreadNumberUsingEv @ 151 NONAME
+	_ZNK16CMemSpyApiThread18ProcessNumberUsingEv @ 152 NONAME
+	_ZNK16CMemSpyApiThread2IdEv @ 153 NONAME
+	_ZNK16CMemSpyApiThread3SIDEv @ 154 NONAME
+	_ZNK16CMemSpyApiThread3VIDEv @ 155 NONAME
+	_ZNK16CMemSpyApiThread4NameEv @ 156 NONAME
+	_ZNK16CMemSpyApiThread6CpuUseEv @ 157 NONAME
+	_ZNK16CMemSpyApiThread8ExitTypeEv @ 158 NONAME
+	_ZNK16CMemSpyApiThread9ProcessIdEv @ 159 NONAME
+	_ZNK17CMemSpyApiProcess10ExitReasonEv @ 160 NONAME
+	_ZNK17CMemSpyApiProcess11ThreadCountEv @ 161 NONAME
+	_ZNK17CMemSpyApiProcess12ExitCategoryEv @ 162 NONAME
+	_ZNK17CMemSpyApiProcess2IdEv @ 163 NONAME
+	_ZNK17CMemSpyApiProcess3SIDEv @ 164 NONAME
+	_ZNK17CMemSpyApiProcess3VIDEv @ 165 NONAME
+	_ZNK17CMemSpyApiProcess4NameEv @ 166 NONAME
+	_ZNK17CMemSpyApiProcess6IsDeadEv @ 167 NONAME
+	_ZNK17CMemSpyApiProcess8ExitTypeEv @ 168 NONAME
+	_ZNK17CMemSpyApiProcess8PriorityEv @ 169 NONAME
+	_ZNK21CMemSpyApiWindowGroup15OrdinalPositionEv @ 170 NONAME
+	_ZNK21CMemSpyApiWindowGroup17WindowGroupHandleEv @ 171 NONAME
+	_ZNK21CMemSpyApiWindowGroup2IdEv @ 172 NONAME
+	_ZNK21CMemSpyApiWindowGroup3UidEv @ 173 NONAME
+	_ZNK21CMemSpyApiWindowGroup4NameEv @ 174 NONAME
+	_ZNK21CMemSpyApiWindowGroup6IsBusyEv @ 175 NONAME
+	_ZNK21CMemSpyApiWindowGroup7CaptionEv @ 176 NONAME
+	_ZNK21CMemSpyApiWindowGroup7DocNameEv @ 177 NONAME
+	_ZNK21CMemSpyApiWindowGroup8FullNameEv @ 178 NONAME
+	_ZNK21CMemSpyApiWindowGroup8IsHiddenEv @ 179 NONAME
+	_ZNK21CMemSpyApiWindowGroup8IsSystemEv @ 180 NONAME
+	_ZNK21CMemSpyApiWindowGroup8PriorityEv @ 181 NONAME
+	_ZNK21CMemSpyApiWindowGroup8ThreadIdEv @ 182 NONAME
+	_ZNK21CMemSpyApiWindowGroup9IsFocusedEv @ 183 NONAME
+	_ZNK22CMemSpyApiEComCategory14InterfaceCountEv @ 184 NONAME
+	_ZNK22CMemSpyApiEComCategory2IdEv @ 185 NONAME
+	_ZNK22CMemSpyApiEComCategory4NameEv @ 186 NONAME
+	_ZNK22CMemSpyApiKernelObject4NameEv @ 187 NONAME
+	_ZNK22CMemSpyApiKernelObject4SizeEv @ 188 NONAME
+	_ZNK22CMemSpyApiKernelObject4TypeEv @ 189 NONAME
+	_ZNK22CMemSpyApiKernelObject5CountEv @ 190 NONAME
+	_ZNK23CMemSpyApiEComInterface19ImplementationCountEv @ 191 NONAME
+	_ZNK23CMemSpyApiEComInterface2IdEv @ 192 NONAME
+	_ZNK23CMemSpyApiEComInterface4NameEv @ 193 NONAME
+	_ZNK24CMemSpyApiThreadInfoItem5ValueEv @ 194 NONAME
+	_ZNK24CMemSpyApiThreadInfoItem7CaptionEv @ 195 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem10AttributesEv @ 196 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem10NameDetailEv @ 197 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem10ProtectionEv @ 198 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem10TimerStateEv @ 199 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem11AccessCountEv @ 200 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem11NameOfOwnerEv @ 201 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem11SessionTypeEv @ 202 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem12RestrictionsEv @ 203 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem12SecurityZoneEv @ 204 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem14SvrSessionTypeEv @ 205 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem16ControllingOwnerEv @ 206 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem16TotalAccessCountEv @ 207 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem2IdEv @ 208 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem3TopEv @ 209 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem4NameEv @ 210 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem4SizeEv @ 211 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem4TypeEv @ 212 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem5CountEv @ 213 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem5OrderEv @ 214 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem5StateEv @ 215 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem6BottomEv @ 216 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem6HandleEv @ 217 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem7ChangesEv @ 218 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem7MapAttrEv @ 219 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem7MaxSizeEv @ 220 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem7VersionEv @ 221 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem8MapCountEv @ 222 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem8MsgCountEv @ 223 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem8MsgLimitEv @ 224 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem8PriorityEv @ 225 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem8StartPosEv @ 226 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem8UniqueIDEv @ 227 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem9ChunkTypeEv @ 228 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem9CreatorIdEv @ 229 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem9ParseMaskEv @ 230 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem9ResettingEv @ 231 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem9TimerTypeEv @ 232 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem9UnitsMaskEv @ 233 NONAME
+	_ZNK26CMemSpyApiKernelObjectItem9WaitCountEv @ 234 NONAME
+	_ZNK28CMemSpyApiEComImplementation10OpaqueDataEv @ 235 NONAME
+	_ZNK28CMemSpyApiEComImplementation17ImplementationUidEv @ 236 NONAME
+	_ZNK28CMemSpyApiEComImplementation4NameEv @ 237 NONAME
+	_ZNK28CMemSpyApiEComImplementation5DriveEv @ 238 NONAME
+	_ZNK28CMemSpyApiEComImplementation7RomOnlyEv @ 239 NONAME
+	_ZNK28CMemSpyApiEComImplementation7VersionEv @ 240 NONAME
+	_ZNK28CMemSpyApiEComImplementation8DataTypeEv @ 241 NONAME
+	_ZNK28CMemSpyApiEComImplementation8DisabledEv @ 242 NONAME
+	_ZNK28CMemSpyApiEComImplementation8RomBasedEv @ 243 NONAME
+	_ZNK28CMemSpyApiEComImplementation8VendorIdEv @ 244 NONAME
+	_ZNK29CMemSpyApiMemoryTrackingCycle10FreeMemoryEv @ 245 NONAME
+	_ZNK29CMemSpyApiMemoryTrackingCycle11ChangeCountEv @ 246 NONAME
+	_ZNK29CMemSpyApiMemoryTrackingCycle11CycleNumberEv @ 247 NONAME
+	_ZNK29CMemSpyApiMemoryTrackingCycle11MemoryDeltaEv @ 248 NONAME
+	_ZNK29CMemSpyApiMemoryTrackingCycle17PreviousCycleDiffEv @ 249 NONAME
+	_ZNK29CMemSpyApiMemoryTrackingCycle4TimeEv @ 250 NONAME
+	_ZNK29CMemSpyApiMemoryTrackingCycle7CaptionEv @ 251 NONAME
+	_ZNK34TMemSpyDeviceWideOperationProgress11DescriptionEv @ 252 NONAME
+	_ZNK34TMemSpyDeviceWideOperationProgress8ProgressEv @ 253 NONAME
 
--- a/perfsrv/memspy/MemSpyClient/group/MemSpyClient.mmp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/group/MemSpyClient.mmp	Mon Oct 04 02:45:59 2010 +0300
@@ -37,6 +37,7 @@
 SOURCE		memspyapimemorytrackingcycle.cpp
 SOURCE 		memspyapiserver.cpp
 SOURCE 		memspyapiecom.cpp  
+SOURCE 		memspyapiwindowgroup.cpp
 
 USERINCLUDE ../inc
 
--- a/perfsrv/memspy/MemSpyClient/group/bld.inf	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/group/bld.inf	Mon Oct 04 02:45:59 2010 +0300
@@ -38,6 +38,7 @@
 ../inc/memspyapimemorytrackingcycle.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapimemorytrackingcycle.h)
 ../inc/memspyapiserver.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapiserver.h)
 ../inc/memspyapiecom.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapiecom.h)
+../inc/memspyapiwindowgroup.h OS_LAYER_PLATFORM_EXPORT_PATH(memspy/api/memspyapiwindowgroup.h)
 
 PRJ_MMPFILES
 MemSpyClient.mmp
\ No newline at end of file
--- a/perfsrv/memspy/MemSpyClient/inc/memspyapimemorytrackingcycle.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapimemorytrackingcycle.h	Mon Oct 04 02:45:59 2010 +0300
@@ -22,7 +22,7 @@
 
 class TMemSpyMemoryTrackingCycleData;
 
-class CMemSpyApiMemoryTrackingCycle
+NONSHARABLE_CLASS( CMemSpyApiMemoryTrackingCycle )
 	{
 public: // API
 	IMPORT_C TInt CycleNumber() const;
--- a/perfsrv/memspy/MemSpyClient/inc/memspyapiserver.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapiserver.h	Mon Oct 04 02:45:59 2010 +0300
@@ -33,7 +33,9 @@
 	static CMemSpyApiServer* NewLC(const TMemSpyServerData& aData);
 	
 public:
-	IMPORT_C TProcessId Id() const;
+	IMPORT_C TProcessId ProcessId() const;
+	
+	IMPORT_C TThreadId ThreadId() const;
 	
 	IMPORT_C const TDesC& Name() const;	
 	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyapiwindowgroup.h	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Contains the declaration of  CMemSpyProcess class 
+*/
+
+#ifndef MEMSPYAPIWINDOWGROUP_H
+#define MEMSPYAPIWINDOWGROUP_H
+
+// System includes
+#include <e32base.h>
+#include <f32file.h>
+
+class TMemSpyEngineWindowGroupDetails;
+
+NONSHARABLE_CLASS( CMemSpyApiWindowGroup ) : public CBase
+	{
+public:
+	IMPORT_C ~CMemSpyApiWindowGroup();
+	
+	static CMemSpyApiWindowGroup* NewL(const TMemSpyEngineWindowGroupDetails& aData);
+
+	static CMemSpyApiWindowGroup* NewLC(const TMemSpyEngineWindowGroupDetails& aData);
+	
+public:
+	IMPORT_C TInt Id() const;
+	IMPORT_C const TDesC& Name() const;
+	IMPORT_C const TDesC& FullName() const;
+	IMPORT_C TThreadId ThreadId() const;
+	IMPORT_C TInt OrdinalPosition() const;
+	IMPORT_C TInt Priority() const;
+	IMPORT_C TInt WindowGroupHandle() const;
+	IMPORT_C TUid Uid() const;
+	IMPORT_C TBool IsBusy() const;
+	IMPORT_C TBool IsSystem() const;
+	IMPORT_C TBool IsHidden() const;
+    IMPORT_C const TDesC& Caption() const;
+    IMPORT_C const TDesC& DocName() const;
+    IMPORT_C TBool IsFocused() const;
+	
+private:
+	void ConstructL(const TMemSpyEngineWindowGroupDetails& aData);
+		
+private:
+	TMemSpyEngineWindowGroupDetails *iData;
+};
+
+#endif // MEMSPYAPIWINDOWGROUP_H
--- a/perfsrv/memspy/MemSpyClient/inc/memspyserverdata.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/inc/memspyserverdata.h	Mon Oct 04 02:45:59 2010 +0300
@@ -24,12 +24,13 @@
 public:
 	//constructor & destructor
 	inline TMemSpyServerData()
-		: iId(0), iSessionCount(0)
+		: iProcessId(0), iThreadId(0), iSessionCount(0)
 		{
 		}
 	
 public:
-    TProcessId iId;        
+    TProcessId iProcessId;
+    TThreadId iThreadId;
     TFullName iName;
     TInt iSessionCount;
 	};
--- a/perfsrv/memspy/MemSpyClient/inc/memspysession.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/inc/memspysession.h	Mon Oct 04 02:45:59 2010 +0300
@@ -50,6 +50,8 @@
 
 #include <memspy/api/memspyapiecom.h>
 
+#include <memspy/api/memspyapiwindowgroup.h>
+
 // Constants
 const TInt KMemSpyVersion           = 2;
 
@@ -272,6 +274,9 @@
 	
 	IMPORT_C void GetEComImplementationsL(TUid aInterface, RArray<CMemSpyApiEComImplementation*> &aImplementations);
 	
+	// Window Groups
+	IMPORT_C void GetWindowGroupsL(RArray<CMemSpyApiWindowGroup*> &aGroups);
+	
 private:
     TInt StartServer();       
     
--- a/perfsrv/memspy/MemSpyClient/src/memspyapiserver.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapiserver.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -24,11 +24,16 @@
 	delete iData;
 	}
 
-EXPORT_C TProcessId CMemSpyApiServer::Id() const
+EXPORT_C TProcessId CMemSpyApiServer::ProcessId() const
 	{
-	return iData->iId;
+	return iData->iProcessId;
 	}
 
+EXPORT_C TThreadId CMemSpyApiServer::ThreadId() const
+    {
+    return iData->iThreadId;
+    }
+
 EXPORT_C const TDesC& CMemSpyApiServer::Name() const
 	{
 	return iData->iName;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/perfsrv/memspy/MemSpyClient/src/memspyapiwindowgroup.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <f32file.h>
+#include <memspy/api/memspyapiwindowgroup.h>
+#include <memspy/engine/memspyenginehelperwindowserver.h>
+
+
+EXPORT_C CMemSpyApiWindowGroup::~CMemSpyApiWindowGroup()
+	{
+	delete iData;
+	}
+
+EXPORT_C TInt CMemSpyApiWindowGroup::Id() const
+	{
+	return iData->iId;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiWindowGroup::Name() const
+	{
+	return iData->iName;
+	}
+
+EXPORT_C const TDesC& CMemSpyApiWindowGroup::FullName() const
+    {
+    return iData->iFullName;
+    }
+
+EXPORT_C TThreadId CMemSpyApiWindowGroup::ThreadId() const
+    {
+    return iData->iThreadId;
+    }
+
+EXPORT_C TInt CMemSpyApiWindowGroup::OrdinalPosition() const
+    {
+    return iData->iOrdinalPosition;
+    }
+
+EXPORT_C TInt CMemSpyApiWindowGroup::Priority() const
+    {
+    return iData->iPriority;
+    }
+
+EXPORT_C TInt CMemSpyApiWindowGroup::WindowGroupHandle() const
+    {
+    return iData->iWindowGroupHandle;
+    }
+
+EXPORT_C TUid CMemSpyApiWindowGroup::Uid() const
+    {
+    return iData->iUID;
+    }
+
+EXPORT_C TBool CMemSpyApiWindowGroup::IsBusy() const
+    {
+    return iData->iIsBusy;
+    }
+
+EXPORT_C TBool CMemSpyApiWindowGroup::IsSystem() const
+    {
+    return iData->iIsSystem;
+    }
+
+EXPORT_C TBool CMemSpyApiWindowGroup::IsHidden() const
+    {
+    return iData->iIsHidden;
+    }
+
+EXPORT_C const TDesC& CMemSpyApiWindowGroup::Caption() const
+    {
+    return iData->iCaption;
+    }
+
+EXPORT_C const TDesC& CMemSpyApiWindowGroup::DocName() const
+    {
+    return iData->iDocName;
+    }
+
+EXPORT_C TBool CMemSpyApiWindowGroup::IsFocused() const
+    {
+    return iData->iIsFocused;
+    }
+
+void CMemSpyApiWindowGroup::ConstructL(const TMemSpyEngineWindowGroupDetails& aData)
+	{
+	iData = new (ELeave) TMemSpyEngineWindowGroupDetails( aData );
+	}
+
+CMemSpyApiWindowGroup* CMemSpyApiWindowGroup::NewL(const TMemSpyEngineWindowGroupDetails& aData)
+	{
+    CMemSpyApiWindowGroup* self = CMemSpyApiWindowGroup::NewLC( aData );
+	CleanupStack::Pop(self);
+	return (self);
+	}
+
+CMemSpyApiWindowGroup* CMemSpyApiWindowGroup::NewLC(const TMemSpyEngineWindowGroupDetails& aData)
+	{
+    CMemSpyApiWindowGroup* self = new (ELeave) CMemSpyApiWindowGroup;
+	CleanupStack::PushL( self );
+	self->ConstructL( aData );
+	return ( self );
+	}
--- a/perfsrv/memspy/MemSpyClient/src/memspysession.cpp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyClient/src/memspysession.cpp	Mon Oct 04 02:45:59 2010 +0300
@@ -31,6 +31,8 @@
 #include <memspy/engine/memspyserverdata.h>
 // ECom
 #include <memspy/engine/memspyecomdata.h>
+// Window groups
+#include <memspy/engine/memspyenginehelperwindowserver.h>
 
 // IMPLEMENTATION
 
@@ -504,6 +506,29 @@
     CleanupStack::PopAndDestroy(buffer);
     }
 
+EXPORT_C void RMemSpySession::GetWindowGroupsL(RArray<CMemSpyApiWindowGroup*> &aGroups)
+    {
+    TPckgBuf<TInt> count;
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetWindowGroupCount, TIpcArgs(&count)));
+    
+    TInt requestedCount = count();
+    HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyEngineWindowGroupDetails));
+    TPtr8 bufferPtr(buffer->Des());
+    
+    User::LeaveIfError(SendReceive(EMemSpyClientServerOpGetWindowGroups, TIpcArgs(&count, &bufferPtr)));
+    aGroups.Reset();
+    
+    TInt receivedCount = Min(count(), requestedCount);
+    for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyEngineWindowGroupDetails))
+        {
+        TPckgBuf<TMemSpyEngineWindowGroupDetails> data;
+        data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyEngineWindowGroupDetails));
+        aGroups.AppendL(CMemSpyApiWindowGroup::NewLC(data()));
+        }
+    CleanupStack::Pop(aGroups.Count());
+    CleanupStack::PopAndDestroy(buffer);
+    }
+
 EXPORT_C void RMemSpySession::DumpKernelHeap()
 	{
 	SendReceive( EMemSpyClientServerOpDumpKernelHeap );
--- a/perfsrv/memspy/MemSpyServer/group/MemSpyServer.mmp	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/MemSpyServer/group/MemSpyServer.mmp	Mon Oct 04 02:45:59 2010 +0300
@@ -38,7 +38,6 @@
 
 OS_LAYER_SYSTEMINCLUDE
 
-APP_LAYER_SYSTEMINCLUDE
 
 LIBRARY         MemSpyDriverClient.lib
 LIBRARY         MemSpyEngine.lib
--- a/perfsrv/memspy/group/ReleaseNotes_MemSpy.txt	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/group/ReleaseNotes_MemSpy.txt	Mon Oct 04 02:45:59 2010 +0300
@@ -1,7 +1,7 @@
 ===============================================================================
 
-RELEASE NOTES - MEMSPY v2.2.0
-RELEASED 24th August 2010 
+RELEASE NOTES - MEMSPY v2.2.1
+RELEASED 7th September 2010 
 
 SUPPORTS S60 5.0+
 
@@ -28,11 +28,12 @@
 
 ===============================================================================
 
-What's New in v2.2.0
+What's New in v2.2.1
 ====================
-- Feature: Servers view to display a list of running servers.
-- Feature: ECom view to display ECom categories, interfaces and implementations.
-- Feature: Processes can be now terminated.
+- Feature: Window Groups view to display window server items.
+- Fix: SWMT Timer status mismatch.
+- Fix: Non-supported SWMT categories removed.
+- Fix: Options - Open in Servers view not working.
 
 ===============================================================================
 
@@ -95,6 +96,12 @@
 Version History:
 ================
 
+Version 2.2.0 - 24th August 2010
+--------------------------------
+- Feature: Servers view to display a list of running servers.
+- Feature: ECom view to display ECom categories, interfaces and implementations.
+- Feature: Processes can be now terminated.
+
 Version 2.1.0 - 15th June 2010 
 ------------------------------
 - Feature: Folder where log files are saved can now be set in settings.
--- a/perfsrv/memspy/memspy_plat/memspy_api/include/MemSpyEngineClientInterface.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/MemSpyEngineClientInterface.h	Mon Oct 04 02:45:59 2010 +0300
@@ -379,6 +379,10 @@
 	            
 	EMemSpyClientServerOpGetEComImplementations,
 	
+	EMemSpyClientServerOpGetWindowGroupCount,
+	    
+	EMemSpyClientServerOpGetWindowGroups,
+	
 	EMemSpyClientServerOpMarkerUiLast,		
 	
 	/**
--- a/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/kernel/MemSpyDriverPanics.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/kernel/MemSpyDriverPanics.h	Mon Oct 04 02:45:59 2010 +0300
@@ -48,7 +48,8 @@
     EPanicKernelHeapDataInitError,
     EPanicKernelHeapDataFetchError,
     EPanicHeapFreeCellStreamNotClosed,
-    EPanicHeapFreeCellStreamNotOpen
+    EPanicHeapFreeCellStreamNotOpen,
+    EPanicHeapKernelCopyExpected,
 	};
 
 
--- a/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverClient.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/driver/user/MemSpyDriverClient.h	Mon Oct 04 02:45:59 2010 +0300
@@ -30,18 +30,18 @@
 
 
 class RMemSpyDriverClient : public RBusLogicalChannel
-	{
+    {
 public: // GENERAL API
 
     /**
      *
      */
-	IMPORT_C TInt Open();
+    IMPORT_C TInt Open();
 
     /**
      *
      */
-	IMPORT_C void Close();
+    IMPORT_C void Close();
 
     /**
      *
@@ -54,7 +54,7 @@
     /**
      *
      */
-	IMPORT_C TInt ReadMemory( TUint aTid, TLinAddr aSrc, TDes8& aDest );
+    IMPORT_C TInt ReadMemory( TUint aTid, TLinAddr aSrc, TDes8& aDest );
 
 
 public: // CODE SEGS
@@ -62,17 +62,17 @@
     /**
      *
      */
-	IMPORT_C TInt GetCodeSegs( TAny** aHandleArray, TInt& aHandleCount, TBool aOnlyRamLoaded = EFalse );
+    IMPORT_C TInt GetCodeSegs( TAny** aHandleArray, TInt& aHandleCount, TBool aOnlyRamLoaded = EFalse );
 
     /**
      *
      */
-	IMPORT_C TInt GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount );
+    IMPORT_C TInt GetCodeSegs( TUint aPid, TAny** aHandleArray, TInt& aHandleCount );
 
     /**
      *
      */
-	IMPORT_C TInt GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo );
+    IMPORT_C TInt GetCodeSegInfo( TAny* aHandle, TUint aPid, TMemSpyDriverCodeSegInfo& aInfo );
 
 
 public: // CHUNKS
@@ -150,6 +150,22 @@
      */
     IMPORT_C TInt SetPriority( TUint aId, TThreadPriority aPriority );
 
+    
+public: // HEAP KERNEL COPY
+
+    /**
+     * Creates a copy of the kernel heap so long running operations (like dumping the heap data)
+     * don't need to lock the kernel heap.
+     * 
+     * At most one copy of the kernel heap is held at a time. Each time this function is called the 
+     * previous copy, if any, is erased.
+     */
+    IMPORT_C TInt CopyHeapDataKernel();
+    /**
+     * Frees the copy made using CopyHeapDataKernel() 
+     */
+    IMPORT_C TInt FreeHeapDataKernel();
+    
 public: // HEAP INFO
 
     /**
@@ -157,13 +173,16 @@
      */
     IMPORT_C TInt GetHeapInfoUser( TMemSpyHeapInfo& aInfo, TUint aTid );
     IMPORT_C TInt GetHeapInfoUser( TMemSpyHeapInfo& aInfo, TUint aTid, RArray<TMemSpyDriverFreeCell>& aFreeCells );
-	IMPORT_C TInt GetHeapInfoUser(TMemSpyHeapInfo& aInfo, TUint aTid, RArray<TMemSpyDriverCell>& aCells, TBool aCollectAllocatedCellsAsWellAsFree);
+    IMPORT_C TInt GetHeapInfoUser(TMemSpyHeapInfo& aInfo, TUint aTid, RArray<TMemSpyDriverCell>& aCells, TBool aCollectAllocatedCellsAsWellAsFree);
 
     /**
      *
      */
     IMPORT_C TInt GetHeapInfoKernel( TMemSpyHeapInfo& aInfo );
     IMPORT_C TInt GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells );
+    IMPORT_C TInt GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverCell>& aCells, TBool aCollectAllocatedCellsAsWellAsFree);
+    IMPORT_C TInt GetHeapInfoKernel( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverCell>& aCells, TBool aCollectAllocatedCellsAsWellAsFree, TBool aUseKernelCopy);
+    
 
 public: // HEAP DATA
 
@@ -178,10 +197,16 @@
     IMPORT_C TInt GetHeapDataNext( TUint aTid, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining );
 
     /**
-     *
+     * Get free cell data. If aFreeCellChecksum is 0, then no checksum comparison is performed.
+     * @pre must be called after CopyHeapDataKernel()    
      */
-    IMPORT_C HBufC8* GetHeapDataKernelLC( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>& aFreeCells );
+    IMPORT_C TInt GetHeapDataKernel( TUint aTid, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining );
 
+    /**
+     * @pre must be called after GetHeapDataKernelNext()
+     */
+    IMPORT_C TInt GetHeapDataKernelNext( TUint aTid, TDes8& aDest, TUint& aReadAddress, TUint& aAmountRemaining );
+        
 
 public: // HEAP WALK
 
@@ -290,17 +315,17 @@
     /**
      * Get all of the handles in a specific container
      */
-	IMPORT_C TInt GetContainerHandles( TMemSpyDriverContainerType aContainer, TAny** aHandleArray, TInt& aHandleCount );
+    IMPORT_C TInt GetContainerHandles( TMemSpyDriverContainerType aContainer, TAny** aHandleArray, TInt& aHandleCount );
 
     /**
      * Get all handles of a specific type, for a specific thread. 
      */
-	IMPORT_C TInt GetThreadHandlesByType( TInt aTid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount );
+    IMPORT_C TInt GetThreadHandlesByType( TInt aTid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount );
 
     /**
      * Get all handles of a specific type, for a specific process. 
      */
-	IMPORT_C TInt GetProcessHandlesByType( TInt aPid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount );
+    IMPORT_C TInt GetProcessHandlesByType( TInt aPid, TMemSpyDriverContainerType aType, TAny** aHandleArray, TInt& aHandleCount );
 
     /**
      * Get handle info for a specific handle owner by a specific thread. If the handle is not thread-specific, then
@@ -325,8 +350,8 @@
      * to see if any of those handle containers happen to reference the specified thread or process (as defined by
      * aTid or aPid).
      */
-	IMPORT_C TInt GetReferencesToMyThread( TUint aTid );
-	IMPORT_C TInt GetReferencesToMyProcess( TUint aPid );
+    IMPORT_C TInt GetReferencesToMyThread( TUint aTid );
+    IMPORT_C TInt GetReferencesToMyProcess( TUint aPid );
 
     /**
      * Get info about a P&S kernel object
@@ -348,7 +373,7 @@
     /**
      * Gets handles of all sessions that are connected to a particular server
      */
-	IMPORT_C TInt GetServerSessionHandles( TAny* aServerHandle, TAny** aSessionHandleArray, TInt& aSessionHandleCount );
+    IMPORT_C TInt GetServerSessionHandles( TAny* aServerHandle, TAny** aSessionHandleArray, TInt& aSessionHandleCount );
 
     /**
      * Gets session information for a given session handle.
@@ -394,7 +419,7 @@
 
 private: // Data members
     RBuf8 iBuffer;
-	};
+    };
 
 
 
--- a/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/Helpers/MemSpyEngineHelperHeap.h	Mon Oct 04 02:45:59 2010 +0300
@@ -56,6 +56,7 @@
     IMPORT_C void OutputCellListingUserL( const CMemSpyThread& aThread );
 
 public: // API - Kernel Heap
+    IMPORT_C void GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells, TBool aCollectAllocatedCellsAsWellAsFree );
     IMPORT_C void GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells = NULL );
     IMPORT_C void OutputHeapInfoKernelL();
     IMPORT_C void OutputHeapDataKernelL();
@@ -69,9 +70,11 @@
     IMPORT_C TMemSpyHeapData NewHeapRawInfo( const TMemSpyHeapInfo& aInfo ); //not formatted heap info
 
 public: // But not exported
-    void OutputHeapDataKernelL( TBool aCreateDataStream );
+    void GetHeapInfoKernelL( TMemSpyHeapInfo& aInfo, RArray<TMemSpyDriverFreeCell>* aFreeCells, TBool aCollectAllocatedCellsAsWellAsFree, TBool aUseKernelCopy = EFalse );
     void OutputHeapDataUserL( const CMemSpyThread& aThread, TBool aCreateDataStream );
     void OutputHeapDataUserL( const TProcessId& aPid, const TThreadId& aTid, const TDesC& aThreadName, const TMemSpyHeapInfo& aInfo, TBool aCreateDataStream, const RArray<TMemSpyDriverFreeCell>* aFreeCells );
+    void OutputHeapDataKernelL( TBool aCreateDataStream );
+    void OutputHeapDataKernelL(const TMemSpyHeapInfo& aHeapInfo, TBool aCreateDataStream, const RArray<TMemSpyDriverCell>* aCells);
 
 private:
     static TUint DescriptorAsDWORD( const TDesC8& aItem );
@@ -80,7 +83,8 @@
 	void AppendCellsL(const RArray<TMemSpyDriverCell>& aCells, CMemSpyEngineOutputList& aList);
     void OutputCSVEntryL( TInt aIndex, const TMemSpyHeapInfo& aInfo, const TDesC& aThreadName, const TDesC& aProcessName );
     void UpdateSharedHeapInfoL( const TProcessId& aProcess, const TThreadId& aThread, TMemSpyHeapInfo& aInfo );
-
+    static void CleanupHeapDataKernel( TAny* aPtr );
+    
 private:
     CMemSpyEngine& iEngine;
     };
--- a/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/memspy_plat/memspy_api/include/memspy/engine/SysMemTracker/MemSpyEngineHelperSysMemTrackerConfig.h	Mon Oct 04 02:45:59 2010 +0300
@@ -58,20 +58,20 @@
         {
         EMemSpyEngineSysMemTrackerCategoryNone            = 0,
         EMemSpyEngineSysMemTrackerCategoryFileServerCache = 0x0001,
-        EMemSpyEngineSysMemTrackerCategoryBitmapHandles   = 0x0002,
-        EMemSpyEngineSysMemTrackerCategoryUserHeap        = 0x0004,
-        EMemSpyEngineSysMemTrackerCategoryKernelHeap      = 0x0008,
-        EMemSpyEngineSysMemTrackerCategoryLocalChunks     = 0x0010,
-        EMemSpyEngineSysMemTrackerCategoryGlobalChunks    = 0x0020,
-        EMemSpyEngineSysMemTrackerCategoryRAMDrive        = 0x0040,
-        EMemSpyEngineSysMemTrackerCategoryUserStacks      = 0x0080,
-        EMemSpyEngineSysMemTrackerCategoryGlobalData      = 0x0100,
-        EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode   = 0x0200,
-        EMemSpyEngineSysMemTrackerCategoryKernelHandles   = 0x0400,
-        EMemSpyEngineSysMemTrackerCategoryOpenFiles       = 0x0800,
-        EMemSpyEngineSysMemTrackerCategoryDiskusage       = 0x1000,
-        EMemSpyEngineSysMemTrackerCategorySystemMemory    = 0x2000,
-        EMemSpyEngineSysMemTrackerCategoryWindowGroups    = 0x4000,
+        //EMemSpyEngineSysMemTrackerCategoryBitmapHandles   = 0x0002,
+        EMemSpyEngineSysMemTrackerCategoryUserHeap        = 0x0002, //0x0004,
+        //EMemSpyEngineSysMemTrackerCategoryKernelHeap      = 0x0008,
+        EMemSpyEngineSysMemTrackerCategoryLocalChunks     = 0x0004, //0x0010,
+        EMemSpyEngineSysMemTrackerCategoryGlobalChunks    = 0x0008, //0x0020,
+        EMemSpyEngineSysMemTrackerCategoryRAMDrive        = 0x0010, //0x0040,
+        //EMemSpyEngineSysMemTrackerCategoryUserStacks      = 0x0080,
+        //EMemSpyEngineSysMemTrackerCategoryGlobalData      = 0x0100,
+        EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode   = 0x0020, //0x0200,
+        EMemSpyEngineSysMemTrackerCategoryKernelHandles   = 0x0040, //0x0400,
+        EMemSpyEngineSysMemTrackerCategoryOpenFiles       = 0x0080, //0x0800,
+        EMemSpyEngineSysMemTrackerCategoryDiskusage       = 0x0100, //0x1000,
+        EMemSpyEngineSysMemTrackerCategorySystemMemory    = 0x0200, //0x2000,
+        EMemSpyEngineSysMemTrackerCategoryWindowGroups    = 0x0400, //0x4000,
         EMemSpyEngineSysMemTrackerCategoryAll             = 0xffff
         };